我想重新命名由npm run build
命名的index.html
.我在网页配置中找不到任何东西.
我还创建了这里描述的vue.config.js
:https://github.com/vuejs/vue-cli/tree/dev/docs/config
module.exports = {
pages: {
index: {
filename: 'dapp.html',
}
}
};
但输出文件仍然是index.html
我想重新命名由npm run build
命名的index.html
.我在网页配置中找不到任何东西.
我还创建了这里描述的vue.config.js
:https://github.com/vuejs/vue-cli/tree/dev/docs/config
module.exports = {
pages: {
index: {
filename: 'dapp.html',
}
}
};
但输出文件仍然是index.html
因为您正在创建vue.配置.我假设您使用的是vue cli 3.0.
鉴于此,您应该在vue上添加以下行.配置.js.
module.exports = {
// modify the location of the generated HTML file.
// make sure to do this only in production.
chainWebpack: (config) => {
if (process.env.NODE_ENV === 'production') {
config.plugin('html').tap((opts) => {
opts[0].filename = './dist/dapp.html';
return opts;
});
}
},
};
Vue的创建者在github https://github.com/yyx990803/laravel-vue-cli-3上设置了一个laravel-Vue-cli-3示例,您可以在其中查看
如果您使用的是vue webpack模板,那么在config文件夹中有一个索引.js文件.舱内.导出您可以在以下位置设置输出:
...
build: {
// Template for index.html
index: path.resolve(__dirname, './dist/index.html'),
...
},
只需更改索引.html和dapp.html,这应该是可行的.
如果你使用的是网页模板,你可以在http://vuejs-templates.github.io/webpack/backend.html页看到更多细节.