From 34922eb239109534679d35a75661d6e2a5603347 Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期六, 27 十二月 2025 10:16:36 +0800
Subject: [PATCH] 成品库流程

---
 WMS/WIDESEA_WMSClient/vue.config.js |  102 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 73 insertions(+), 29 deletions(-)

diff --git a/WMS/WIDESEA_WMSClient/vue.config.js b/WMS/WIDESEA_WMSClient/vue.config.js
index 2d3d8d5..dabdb4b 100644
--- a/WMS/WIDESEA_WMSClient/vue.config.js
+++ b/WMS/WIDESEA_WMSClient/vue.config.js
@@ -1,59 +1,103 @@
-// const webpack = require("webpack");
+// vue.config.js - 閫傞厤 Webpack 4 鐨勭増鏈�
+const path = require('path');
 
 module.exports = {
   productionSourceMap: false,
   lintOnSave: false,
+  
+  // 杞瘧杩欎簺鍖�
+  transpileDependencies: [
+    'vue-router',
+    'vue-draggable-next',
+    'vuex',
+    'element-plus'
+  ],
+  
   devServer: {
     port: 8080,
-    overlay: {
-      warning: false,
-      errors: false
-    }
+    overlay: false,
+    hot: true
   },
+  
   css: {
-    //鏌ョ湅CSS灞炰簬鍝釜css鏂囦欢
     sourceMap: true
   },
+  
   configureWebpack: {
     module: {
       rules: [
+        // 澶勭悊 .mjs 鏂囦欢 - 绠�鍖栫増鏈紝绉婚櫎 fullySpecified
         {
           test: /\.mjs$/,
           include: /node_modules/,
-          type: "javascript/auto"
+          type: 'javascript/auto'
         },
         {
           test: /\.s[ac]ss$/,
-          use: [
-            'sass-loader'
-          ]
+          use: ['sass-loader']
         }
       ]
+    },
+    resolve: {
+      extensions: ['.js', '.vue', '.json', '.mjs'],
+      // Webpack 4 涓嶆敮鎸� fullySpecified锛岀Щ闄ゆ垨鏀逛负鍏朵粬鏂瑰紡
+      mainFields: ['module', 'main']  // 浼樺厛浣跨敤 ES 妯″潡
     }
   },
-  //https://cli.vuejs.org/zh/guide/html-and-static-assets.html#html
+  
   chainWebpack: (config) => {
-    // 绉婚櫎 prefetch 鎻掍欢
     config.plugins.delete('prefetch');
-    //鑷笅瀹氫箟title
     config.plugin('html').tap((args) => {
       args[0].title = 'WMS';
       return args;
     });
-
-    // 鎴栬��
-    // 淇敼瀹冪殑閫夐」锛�
-    // config.plugin('prefetch').tap(options => {
-    //   options[0].fileBlacklist = options[0].fileBlacklist || []
-    //   options[0].fileBlacklist.push(/myasyncRoute(.)+?\.js$/)
-    //   return options
-    // })
+    
+    // ========== 淇 Webpack 4 鍏煎鎬� ==========
+    
+    // 1. 鍒犻櫎鏈夐棶棰樼殑瑙勫垯锛堝鏋滃瓨鍦級
+    config.module.rules.delete('mjs');
+    
+    // 2. 鍒涘缓绠�鍖栫殑 .mjs 澶勭悊瑙勫垯
+    config.module
+      .rule('mjs')
+      .test(/\.mjs$/)
+      .include
+        .add(/node_modules\/vue-router/)
+        .add(/node_modules\/vue-draggable-next/)
+        .add(/node_modules\/element-plus/)
+        .end()
+      .type('javascript/auto');
+    
+    // 3. 閰嶇疆 JS 鏂囦欢澶勭悊
+    config.module
+      .rule('js')
+      .test(/\.js$/)
+      .include
+        .add(path.resolve(__dirname, 'src'))
+        .add(/node_modules\/vue-router/)
+        .add(/node_modules\/vue-draggable-next/)
+        .add(/node_modules\/element-plus/)
+        .add(/node_modules\/vuex/)
+        .end()
+      .use('babel-loader')
+        .loader('babel-loader')
+        .options({
+          cacheDirectory: true,
+          presets: [
+            ['@babel/preset-env', {
+              targets: {
+                browsers: ['> 1%', 'last 2 versions', 'not dead'],
+                node: '16.0.0'
+              },
+              modules: 'commonjs'  // Webpack 4 闇�瑕� commonjs
+            }]
+          ],
+          plugins: [
+            // 澶勭悊鍙�夐摼鎿嶄綔绗�
+            '@babel/plugin-proposal-optional-chaining',
+            // 澶勭悊绌哄�煎悎骞舵搷浣滅
+            '@babel/plugin-proposal-nullish-coalescing-operator'
+          ]
+        });
   }
-  // configureWebpack: {
-  //     plugins: [
-  //         new webpack.optimize.MinChunkSizePlugin({
-  //             minChunkSize: 100000 // 閫氳繃鍚堝苟灏忎簬 minChunkSize 澶у皬鐨� chunk锛屽皢 chunk 浣撶Н淇濇寔鍦ㄦ寚瀹氬ぇ灏忛檺鍒朵互涓�
-  //         })
-  //     ]
-  // }
-};
+};
\ No newline at end of file

--
Gitblit v1.9.3