我有以下vue.config.js
module.exports = {
filenameHashing: false,
productionSourceMap: false,
outputDir: '../vuejs/',
configureWebpack: {
devtool: 'source-map',
output: {
filename: '[name].js'
}
},
pages: {
feature1: {
entry: 'src/f1.js',
template: 'public/feature.html',
filename: 'index1.html',
title: 'Feature 1',
chunks: ['chunk-vendors', 'chunk-common', 'feature1']
},
feature2: {
entry: 'src/f2.js',
template: 'public/feature.html',
filename: 'index2.html',
title: 'Feature 2',
chunks: ['chunk-vendors', 'chunk-common', 'feature2']
}
}
}在npm run build上,它生成:
index1.html
index2.html
feature1.js
feature2.js
js/chunk-vendors.js在dist文件夹(../vuejs/)中
如何更改配置以便将文件chunk-vendors.js放置在根文件夹( feature1.js和feature2.js所在的位置)中。
附言:(额外问题)我实际上不需要html文件,因为我将vue.js *.js嵌入到现有的应用程序中。我可以禁止生成html文件吗?
发布于 2019-06-14 05:56:19
您可以定义一个显式的chunkFilename;例如:
module.exports = {
outputDir: 'my/custom/build/path/',
configureWebpack: (config) => {
config.output.filename = '[name].[hash:8].js';
config.output.chunkFilename = '[name].[hash:8].js';
}
}这应该会产生类似如下的结果:
my/custom/build/path/app.216ad62b.js
my/custom/build/path/app.216ad62b.js.map
my/custom/build/path/chunk-vendors.6f85144f.js
my/custom/build/path/chunk-vendors.6f85144f.js.map希望这能有所帮助:)
https://stackoverflow.com/questions/56114377
复制相似问题