Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更改Vue.js CLI(网页包配置)中chunk-vendors.js的路径_Vue.js_Webpack_Configuration_Command Line Interface - Fatal编程技术网

更改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
没有。谢谢