From 206ec855ef1853430275f6a375142ec7789cc532 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 21 六月 2022 16:54:20 +0800
Subject: [PATCH] 1.优化代码,新增产品部署时不输出console

---
 babel.config.js |   35 +++++++++++++++++++++++++----------
 1 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/babel.config.js b/babel.config.js
index fb82b27..691ee39 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -1,14 +1,29 @@
+// module.exports = {
+//   presets: [
+//     // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
+//     '@vue/cli-plugin-babel/preset'
+//   ],
+//   'env': {
+//     'development': {
+//       // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
+//       // This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
+//       // https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html
+//       'plugins': ['dynamic-import-node']
+//     }
+//   }
+// }
+
+const proPlugins = []
+// 濡傛灉鏄敓浜х幆澧冿紝鍒欎娇鐢ㄥ幓鎺塩onsole鐨勬彃浠�
+if (process.env.NODE_ENV === 'production') {
+  proPlugins.push('transform-remove-console', 'dynamic-import-node')
+}
+
 module.exports = {
   presets: [
-    // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
-    '@vue/cli-plugin-babel/preset'
+    '@vue/app'
   ],
-  'env': {
-    'development': {
-      // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
-      // This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
-      // https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html
-      'plugins': ['dynamic-import-node']
-    }
-  }
+  plugins: [
+    ...proPlugins
+  ]
 }

--
Gitblit v1.9.3