浏览代码

优化 Babel 配置和 Webpack 配置

简化了 Babel 和 Webpack 配置文件中的代码格式,移除了多余的逗号和空格,并确保配置项的书写更加简洁。这些改动没有改变功能,仅提升了代码的可读性和一致性。
SongZihuan 3 月之前
父节点
当前提交
9f4404e6d4
共有 4 个文件被更改,包括 14 次插入15 次删除
  1. 8 9
      babel_config.js
  2. 2 2
      webpack_config_dev.js
  3. 2 2
      webpack_config_github.js
  4. 2 2
      webpack_config_prod.js

+ 8 - 9
babel_config.js

@@ -12,26 +12,25 @@ const config = {
             // "Chrome >= 49",
             // "Firefox >= 45",
             // 或使用 "defaults" 自动选择一组常见的浏览器版本
-            "defaults",
-          ],
+            'defaults'
+          ]
         },
         // 启用或禁用模块转换
         modules: false, // 或 "auto" / "commonjs"
 
         // 可选:按需加载 polyfills
         useBuiltIns: 'usage', // 根据代码实际使用情况自动引入 polyfills
-        corejs: 3, // 如果使用按需加载,需要指定 core-js 的版本
+        corejs: 3 // 如果使用按需加载,需要指定 core-js 的版本
 
         // 可选:包含或排除特定的 transforms
         // exclude: ['transform-regenerator'], // 例如,排除 regenerator 转换
         // include: ['@babel/plugin-proposal-class-properties'], // 或者包含额外的提案特性
-      },
-    ],
+      }
+    ]
   ],
 
   // 可选:包含全局的 Babel 插件
-  plugins: [
-  ],
-};
+  plugins: []
+}
 
-export default config
+export default config

+ 2 - 2
webpack_config_dev.js

@@ -130,8 +130,8 @@ const config = {
         test: /\.(js|mjs|cjs)$/,
         exclude: /(node_modules|bower_components)/,
         use: {
-          loader: 'babel-loader',
-        },
+          loader: 'babel-loader'
+        }
       },
       {
         test: /\.(css|scss|sass)$/,

+ 2 - 2
webpack_config_github.js

@@ -158,8 +158,8 @@ const config = {
         test: /\.(js|mjs|cjs)$/,
         exclude: /(node_modules|bower_components)/,
         use: {
-          loader: 'babel-loader',
-        },
+          loader: 'babel-loader'
+        }
       },
       {
         test: /\.(css|scss|sass)$/,

+ 2 - 2
webpack_config_prod.js

@@ -143,8 +143,8 @@ const config = {
         test: /\.(js|mjs|cjs)$/,
         exclude: /(node_modules|bower_components)/,
         use: {
-          loader: 'babel-loader',
-        },
+          loader: 'babel-loader'
+        }
       },
       {
         test: /\.(css|scss|sass)$/,