我想要重命名由npm run build生成的index.html。我在webpack的配置里找不到任何东西。
我还创建了一个这里描述的vue.config.js:https://github.com/vuejs/vue-cli/tree/dev/docs/config
module.exports = {
pages: {
index: {
filename: 'dapp.html',
}
}
};但是输出文件仍然是index.html
发布于 2018-08-17 16:22:16
由于您正在创建一个vue.config.js,因此我假设您使用的是vue-CLI3.0。
假设您应该在vue.config.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-cli
如果您使用的是vue webpack模板,那么在配置文件夹中有一个index.js文件。在module.exports中,您可以找到以下内容来设置输出:
...
build: {
// Template for index.html
index: path.resolve(__dirname, './dist/index.html'),
...
},只需用dapp.html修改index.html就可以了。
如果你使用的是webpack模板,你可以在http://vuejs-templates.github.io/webpack/backend.html上看到更多详细信息。
发布于 2019-10-22 15:38:26
你可以直接使用
module.exports = {
indexPath: 'index_bundled.html'
}作为更改文件的vue提示默认选项
https://stackoverflow.com/questions/51890879
复制相似问题