当我运行npm run build时,我会得到以下错误消息。
复制-webpack-插件无法找到'path\ to \project\public‘在'path\to\project\public’处
我将public文件夹移到src/main/resources/public。但是,我找不到一个配置来更改路径。我认为相关代码在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']
}]])如何在vue.config.js中重写此操作?
发布于 2018-03-22 19:53:34
这适用于我使用vue-cli 3.0。只需将其添加到vue.config.js文件中即可。
module.exports = {
chainWebpack: config => {
config
.plugin('html')
.tap(args => {
return [{template: '/path/to/index.html'}]
})
}
}虽然这在技术上可能是正确的。
module.exports = {
chainWebpack: config => {
config
.plugin('html')
.tap(args => {
args[0] = {
template: '/path/to/index.html'
}
return args
})
}
}编辑:
实际上,这将是进行此操作的首选方法,这样就不会覆盖其他任何缺省值。
module.exports = {
chainWebpack: config => {
config
.plugin('html')
.tap(args => {
args[0].template = '/path/to/index.html'
return args
})
}
}https://stackoverflow.com/questions/49278322
复制相似问题