在vue.config.js文件中做如下配置
const Timestamp = new Date().getTime()
module.exports = {
configureWebpack: config => {
if (process.env.NODE_ENV === 'production') {
config.output.filename = `js/[name].${Timestamp}.js`
config.output.chunkFilename = `js/[name].${Timestamp}.js`
}
},
css: {
extract: {
filename: `css/[name].${Timestamp}.css`,
chunkFilename: `css/[name].${Timestamp}.css`
}
}
}