From c467a598f23fd81cf624e0abc5f012fb5c9c6ada Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <1247017146@qq.com>
Date: 星期五, 25 四月 2025 09:54:00 +0800
Subject: [PATCH] 1

---
 CodeManagement/BigScreenVue/vue.config.js |  133 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 123 insertions(+), 10 deletions(-)

diff --git a/CodeManagement/BigScreenVue/vue.config.js b/CodeManagement/BigScreenVue/vue.config.js
index 37154ff..c0d86e4 100644
--- a/CodeManagement/BigScreenVue/vue.config.js
+++ b/CodeManagement/BigScreenVue/vue.config.js
@@ -1,16 +1,129 @@
-const path = require('path')
-const resolve = dir => {
-  return path.join(__dirname, dir)
+/*
+ * @Author: daidai
+ * @Date: 2021-11-22 14:57:15
+ * @LastEditors: Please set LastEditors
+ * @LastEditTime: 2022-04-29 15:12:50
+ */
+const path = require("path");
+function resolve(dir) {
+  return path.join(__dirname, dir);
 }
+
 module.exports = {
   publicPath: './',
-  devServer:{
-    host:'0.0.0.0',
-    port:8090
+  outputDir: process.env.VUE_APP_outputDir || 'dist',
+  assetsDir: 'static',
+  filenameHashing: true,
+  lintOnSave: false,
+  runtimeCompiler: false,
+  transpileDependencies: [],
+  productionSourceMap: false,
+  css: {
+    // 鏄惁浣跨敤css鍒嗙鎻掍欢 ExtractTextPlugin
+    extract: process.env.NODE_ENV === "production" ? true : false,//鏄惁灏嗙粍浠朵腑鐨� CSS 鎻愬彇鑷充竴涓嫭绔嬬殑 CSS 鏂囦欢涓� (鑰屼笉鏄姩鎬佹敞鍏ュ埌 JavaScript 涓殑 inline 浠g爜)銆�
+    sourceMap: false,//鏄惁涓� CSS 寮�鍚� source map銆傝缃负 true 涔嬪悗鍙兘浼氬奖鍝嶆瀯寤虹殑鎬ц兘銆�
+    loaderOptions: {
+      sass: {
+        prependData: `@import "@/assets/css/variable.scss";`
+      }
+    },
+    requireModuleExtension: true,
   },
-  chainWebpack: config => {
+
+  chainWebpack: (config) => {
+    // 閰嶇疆鍒悕
     config.resolve.alias
-      .set('_c', resolve('src/components')) // key,value鑷瀹氫箟锛屾瘮濡�.set('@@', resolve('src/components'))
+      .set('@', resolve('src'))
+      .set('assets', resolve('src/assets'))
+      .set('assetsBig', resolve('src/pages/big-screen/assets'))
+      .set('components', resolve('src/components'))
+      .set('views', resolve('src/views'))
+      .set('api', resolve('src/api'))
+      .set('lib', resolve('src/lib'))
+
+    if (process.env.NODE_ENV === "production") {
+      // 鍒犻櫎绯荤粺榛樿鐨剆plitChunk
+      config.optimization.delete("splitChunks");
+    }
+    // 鍒犻櫎棰勫姞杞�
+    //  // 绉婚櫎 prefetch  鎻掍欢
+    //  config.plugins.delete('prefetch-index')
+    //  // 绉婚櫎 preload 鎻掍欢
+    //  config.plugins.delete('preload-index');
+    //   config.optimization.minimizer('terser').tap((args) => {
+    //     // 鍘婚櫎鐢熶骇鐜console
+    //     args[0].terserOptions.compress.drop_console = true
+    //     return args
+    //   })
   },
-  lintOnSave: false
-}
\ No newline at end of file
+  configureWebpack: config => {
+    // 缁欒緭鍑虹殑js鍚嶇О娣诲姞hash
+    config.output.filename = "static/js/[name].[hash].js";
+    config.output.chunkFilename = "static/js/[name].[hash].js";
+    config.optimization = {
+      splitChunks: {
+        cacheGroups: {
+          // 鎶界鎵�鏈夊叆鍙g殑鍏敤璧勬簮涓轰竴涓猚hunk
+          common: {
+            name: "chunk-common",
+            chunks: "initial",
+            minChunks: 2,
+            maxInitialRequests: 5,
+            minSize: 0,
+            priority: 1,
+            reuseExistingChunk: true,
+            enforce: true
+          },
+          // 鎶界node_modules涓嬬殑搴撲负涓�涓猚hunk
+          // vendors: {
+          //   name: "chunk-vendors",
+          //   test: /[\\/]node_modules[\\/]/,
+          //   chunks: "initial",
+          //   priority: 2,
+          //   reuseExistingChunk: true,
+          //   enforce: true
+          // },
+          element: {
+            name: "chunk-element-ui",
+            test: /[\\/]node_modules[\\/]element-ui[\\/]/,
+            chunks: "all",
+            priority: 3,
+            reuseExistingChunk: true,
+            enforce: true
+          },
+          yhhtUi: {
+            name: "chunk-yhht-ui",
+            test: /[\\/]node_modules[\\/]yhht-ui[\\/]/,
+            chunks: "all",
+            priority: 4,
+            reuseExistingChunk: true,
+            enforce: true
+          },
+          datav: {
+            name: "chunk-datav",
+            test: /[\\/]node_modules[\\/]@jiaminghi[\\/]data-view[\\/]/,
+            chunks: "all",
+            priority: 4,
+            reuseExistingChunk: true,
+            enforce: true
+          },
+        }
+      }
+    };
+  },
+  // 鏄惁涓� Babel 鎴� TypeScript 浣跨敤 thread-loader銆傝閫夐」鍦ㄧ郴缁熺殑 CPU 鏈夊浜庝竴涓唴鏍告椂鑷姩鍚敤锛屼粎浣滅敤浜庣敓浜ф瀯寤恒��
+  parallel: require('os').cpus().length > 1,
+  devServer: {
+    // '/api':{
+    //   target: 'http://192.168.8.211:8098/',
+    //   // 璺ㄥ煙閰嶇疆
+    //   changeOrigin: true,
+    //   // 璺緞閲嶅啓 
+    //   pathRewrite:{
+    //         '^/api': '/'
+    //     }
+    // }
+  },
+  pluginOptions: {
+  }
+}

--
Gitblit v1.9.3