Vue 配置打包文件引入带上时间戳
修改 vue.config.js
const { defineConfig } = require('@vue/cli-service')
const timestamp = new Date().getTime()
module.exports = defineConfig({
css: {
extract: {
filename: `css/[name]-[hash:8].css?ver=${timestamp}`,
chunkFilename: `css/[name].css?ver=${timestamp}`
}
},
configureWebpack: {
output: {
filename: `js/[name]-[hash:8].js?ver=${timestamp}`,
chunkFilename: `js/[name].js?ver=${timestamp}`
}
}
})