Explorar el Código

配置vue.config.js按时间戳打包

sunlupeng hace 10 meses
padre
commit
0bb6dc0437
Se han modificado 1 ficheros con 11 adiciones y 0 borrados
  1. 11 0
      vue.config.js

+ 11 - 0
vue.config.js

@@ -12,6 +12,7 @@ const cdn = {
     // `https://cdn.bootcdn.net/ajax/libs/vue-router/3.5.1/vue-router.min.js`,
   ]
 };
+const timestamp = new Date().getTime();
 module.exports = defineConfig({
   devServer:{
     host: '192.168.100.104',
@@ -22,7 +23,17 @@ module.exports = defineConfig({
   // 具体使用情况还需要看项目的配置
   publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
   assetsDir: 'static',
+  css: {
+      extract: {
+          filename: `assert/css/[name].${timestamp}.css`,
+          chunkFilename: `assert/css/[name].${timestamp}.css`
+      }
+  },
   configureWebpack: {
+    output: {
+        filename: `assert/js/[name].${timestamp}.js`,
+        chunkFilename: `assert/js/[name].${timestamp}.js`
+    },
     externals: {
       // vue: 'Vue',
       // 'vue-router': 'VueRouter',