فهرست منبع

如果有warning,那么就构建失败。

Michael Wang 6 سال پیش
والد
کامیت
c037da2dd2
2فایلهای تغییر یافته به همراه13 افزوده شده و 7 حذف شده
  1. 6 1
      babel.config.js
  2. 7 6
      vue.config.js

+ 6 - 1
babel.config.js

@@ -1,3 +1,8 @@
 module.exports = {
-  presets: ["@vue/app"]
+  presets: ["@vue/app"],
+  env: {
+    production: {
+      plugins: ["transform-remove-console"]
+    }
+  }
 };

+ 7 - 6
vue.config.js

@@ -43,15 +43,16 @@ let proxy = {
 
 var webpack = require("webpack");
 
-const plugins = [];
+// const plugins = [];
 // Ignore all locale files of moment.js
 // TODO: use webpack stats to check if iview locale matters
-plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment|iview$/));
-if (process.env.NODE_ENV === "production") {
-  plugins.push("transform-remove-console");
-}
+// plugins.push();
+// if (process.env.NODE_ENV === "production") {
+//   plugins.push("transform-remove-console");
+// }
 
 module.exports = {
+  lintOnSave: process.env.NODE_ENV !== "production" ? true : "error",
   devServer: {
     proxy
   },
@@ -68,6 +69,6 @@ module.exports = {
       .end();
   },
   configureWebpack: {
-    plugins
+    plugins: [new webpack.IgnorePlugin(/^\.\/locale$/, /moment|iview$/)]
   }
 };