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`
? ? ? ? ? ? }])
? ? ? ? }
? ? }
}

打包出來的js中都包含該時間戳,也可以修改成自己想要的標識
參考來源:https://blog.csdn.net/superKM/article/details/102471167?biz_id=102