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}`
    }
  }
})
posted @ 2022-04-30 17:06  RockFane  阅读(1783)  评论(0编辑  收藏  举报