vue cli加时间戳 解决更新服务器缓存问题

在 vue.config.js 的文件中加入下面这段话

const Timestamp = new Date().getTime();
module.exports = {
  configureWebpack: { // webpack 配置
    output: { // 输出重构  打包编译后的 文件名称  【模块名称.版本号.时间戳】
      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` }
    ]) }, }, }

 

posted @ 2022-01-13 16:23  三线码工  阅读(638)  评论(0编辑  收藏  举报