const HtmlWebpackPlugin = require('html-webpack-plugin');
...
chainWebpack: config => {
config
.plugin('html')
.use(HtmlWebpackPlugin)
.tap(options => {
options.BASE_URL = 'sss'
options.template = __dirname + '/public/index.html'
options.title = 'sssssssssssss'
return options
})
}
注意看vue-cli3引用的html-webpack-plugin默认配置
constructor (options) {
// Default options
this.options = _.extend({
template: path.join(__dirname, 'default_index.ejs'),
templateParameters: templateParametersGenerator,
filename: 'index.html',
hash: false,
inject: true,
compile: true,
favicon: false,
minify: false,
cache: true,
showErrors: true,
chunks: 'all',
excludeChunks: [],
chunksSortMode: 'auto',
meta: {},
title: 'Webpack App',
xhtml: false
}, options);
}