VUE vue-cli3配置打包后的文件加上版本号
2021-06-18 本文已影响0人
小拇指的约定021
const Timestamp = new Date().getTime();
module.exports = {
// webpack配置
chainWebpack: config => {
if (process.env.NODE_ENV === 'production') {
// 给js和css配置版本号
config.output.filename('js/[name].' + Timestamp + '.js').end();
config.output.chunkFilename('js/[name].' + Timestamp + '.js').end();
config.plugin('extract-css').tap(args => [{
filename: `css/[name].${Timestamp}.css`,
chunkFilename: `css/[name].${Timestamp}.css`
}])
}
}
}

参考来源:https://blog.csdn.net/superKM/article/details/102471167?biz_id=102