When I run npm run build
I get the following error message.
[copy-webpack-plugin] unable to locate 'path\to\project\public' at 'path\to\project\public'
I moved the public
folder to src/main/resources/public
. However I can't find a config to change the path. I think the relevant code is in node_modules\@vue\cli-service\lib\config\app.js
// copy static assets in public/
webpackConfig
.plugin('copy')
.use(require('copy-webpack-plugin'), [[{
from: api.resolve('public'),
to: api.resolve(options.outputDir),
ignore: ['index.html', '.DS_Store']
}]])
How do I override this in vue.config.js?
The public folder is the folder where we have to store static assets, like CSS files and images, media files that don't change over time. In the Vue-cli project, the index file is located within the public folder. Favicon.
You can also use the vue config command to inspect or modify the global CLI config.
This can be simply done by changing the content of the <title> tag in our html code. But for Single-Page Applications, things are a little bit different. When the router changes to a different page component, the title should be changed programmatically using document. title = 'new title' .
This works for me using vue-cli 3.0. Just add it to your vue.config.js file.
module.exports = {
chainWebpack: config => {
config
.plugin('html')
.tap(args => {
return [{template: '/path/to/index.html'}]
})
}
}
Though this might be more technically correct.
module.exports = {
chainWebpack: config => {
config
.plugin('html')
.tap(args => {
args[0] = {
template: '/path/to/index.html'
}
return args
})
}
}
Edit:
Actually this would be the preferred way of doing this so that none of the other defaults are overwritten.
module.exports = {
chainWebpack: config => {
config
.plugin('html')
.tap(args => {
args[0].template = '/path/to/index.html'
return args
})
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With