更改Vue.js CLI(网页包配置)中chunk-vendors.js的路径
我有以下更改Vue.js CLI(网页包配置)中chunk-vendors.js的路径,vue.js,webpack,configuration,command-line-interface,Vue.js,Webpack,Configuration,Command Line Interface,我有以下vue.config.js: module.exports = { filenameHashing: false, productionSourceMap: false, outputDir: '../vuejs/', configureWebpack: { devtool: 'source-map', output: { filename: '[name].js' } }, pages: { feature1: { ent
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运行构建时,它生成:
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文件吗?您可以定义一个显式的;e、 g:
module.exports={
outputDir:'my/custom/build/path/',
配置网页包:(配置)=>{
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
希望这有帮助:)你看过了吗。您应该能够指定另一个属性path@CodeSurvivor嗨-谢谢你的提示。我使用vue cli服务构建命令中建议的outputDir。如果尝试使用output.path,则会得到:配置错误:避免直接修改webpack output.path。改用“outputDir”选项。如前所述,我在正确的位置获得了feature1和feature2中的两个文件。只有chunk-vendors.js进入./js/文件夹…Hi@AlexanderMihailov-这有什么成功的地方吗?我也有同样的问题,outputDir
正在我想要的地方构建主应用程序文件,但是chunk vendors
没有。谢谢