-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Additional public directory paths #1550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That shouldn't require much more than: chainWebpack: config => {
config.plugin('copy')
.tap(([pathConfigs]) => {
const to = pathConfigs[0].to
pathConfigs[0].force = true // so the original `/public` folder keeps priority
// add other locations.
pathConfigs.unshift({
from: 'some/path',
to,
})
return [pathConfigs]
})
} |
I'm getting this error when I delete '/public' folfer.
|
@LinusBorg Your solution works if --modern is not provided. Once it is provided, you get the same error @Miaoxingren . [pathConfigs] becomes an empty array when --modern is provided on the cli. When a config is "forced" (@Miaoxingren 's example), you get the __expression error. |
Yeah, the copy webpack plugin is skipped during modern mode as we only want to copy files once. Can be fixed like this: config.plugins.has('copy') && config.plugin('copy').tap(([pathConfigs]) => { ... I'll close this request as we currently don't see this as something to add to the cli config. For multiple plubc dirs, people can add paths like I showed, or simply add a new instance of the copy plugin. |
In vue.config.js const path = require('path');
module.exports = {
...
configureWebpack: {
devServer: {
contentBase: [
path.join(process.cwd(), './public'),
path.join(process.cwd(), './docs')
],
},
},
}; |
This is the easiest to request images from. It's not quite clean, especially if one wants to move this to another repo later. This almost works to add another public folder: vuejs/vue-cli#1550 But it passes the files though the minifier which I don't like.
What problem does this feature solve?
When using vue-cli in a monorepo project there might be apps sharing the public folder content, at least partially. With the current static public folder those apps must duplicate that content.
What does the proposed API look like?
A
public
config option, allowing to set a array of paths that will be looked at for the content to be copied. The current public dir should be always considered and taken as priority.The text was updated successfully, but these errors were encountered: