Pārlūkot izejas kodu

打包文件时间戳

Shannon_mu 2 gadi atpakaļ
vecāks
revīzija
bdfbed7482
1 mainītis faili ar 8 papildinājumiem un 8 dzēšanām
  1. 8 8
      operationSupport/vue.config.js

+ 8 - 8
operationSupport/vue.config.js

@@ -34,9 +34,9 @@ module.exports = {
                 viewportWidth: 1920 //传参
             });
 
-        // // // 配置每次打包浏览器缓存文件名的随机性
-        // const filename = path.posix.join('js', `${new Date().getTime()}_[name].js`);
-        // config.mode('production').devtool(false).output.filename(filename).chunkFilename(filename);
+        // // 配置每次打包浏览器缓存文件名的随机性
+        const filename = path.posix.join('js', `${new Date().getTime()}_[name].js`);
+        config.mode('production').devtool(false).output.filename(filename).chunkFilename(filename);
     },
     // 配置全局样式变量
     css: {
@@ -59,12 +59,12 @@ module.exports = {
             //         resources: path.relative(__dirname, '../src/assets/css/punlic-style.scss')
             //     }
             // })
+        },
+        extract: {
+            // 打包后css文件名称添加时间戳
+            filename: `css/[name].${new Date().getTime()}.css`,
+            chunkFilename: `css/chunk.[id].${new Date().getTime()}.css`
         }
-        // extract: {
-        //     // 打包后css文件名称添加时间戳
-        //     filename: `css/[name].${new Date().getTime()}.css`,
-        //     chunkFilename: `css/chunk.[id].${new Date().getTime()}.css`
-        // }
     },
     configureWebpack: {
         externals: {