Jhernandez has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/372831 )

Change subject: Chore: Add VERBOSE env var for webpack config
......................................................................

Chore: Add VERBOSE env var for webpack config

There are times where you want to see all the info on the build process.
Add a VERBOSE env variable with which you can enable logging options.

The default remains staying silent unless errors/warnings.

Change-Id: Ia9dfc7b7af48c1d694ca6624e2d0209c4f50f6b3
---
M webpack.config.js
1 file changed, 16 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/marvin refs/changes/31/372831/1

diff --git a/webpack.config.js b/webpack.config.js
index b2b434b..df75644 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -4,6 +4,8 @@
 const ExtractTextPlugin = require("extract-text-webpack-plugin");
 
 const isProd = process.env.NODE_ENV === "production";
+const isVerbose = Boolean(JSON.parse(process.env.VERBOSE || "false"));
+
 const paths = {
   client: {
     output: path.resolve("./dist/public/")
@@ -13,13 +15,17 @@
 // There is no builtin Stats "warnings" preset.
 // https://github.com/webpack/webpack/blob/7fe0371/lib/Stats.js#L886
 // https://github.com/webpack/webpack/blob/7fe0371/lib/Stats.js#L101-L131
-const WARNINGS_STATS_PRESET = {
-  all: false, // Default all options to false.
-  errors: true,
-  errorDetails: true,
-  moduleTrace: true,
-  warnings: true
-};
+const WARNINGS_STATS_PRESET = isVerbose
+  ? {
+      all: true
+    }
+  : {
+      all: false, // Default all options to false.
+      errors: true,
+      errorDetails: true,
+      moduleTrace: true,
+      warnings: true
+    };
 
 module.exports = {
   entry: {
@@ -50,7 +56,7 @@
         test: /\.tsx?$/,
         loader: "ts-loader",
         options: {
-          logLevel: "warn"
+          logLevel: isVerbose ? "info" : "warn"
         }
       },
       {
@@ -75,10 +81,10 @@
         contentBase: false,
 
         // Log warnings and errors in the browser console.
-        clientLogLevel: "warning",
+        clientLogLevel: isVerbose ? "info" : "warning",
 
         // Hide bundling start and finish messages.
-        noInfo: true,
+        noInfo: !isVerbose,
 
         // Show warnings and errors as an obtrusive opaque overlay in the
         // browser.

-- 
To view, visit https://gerrit.wikimedia.org/r/372831
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9dfc7b7af48c1d694ca6624e2d0209c4f50f6b3
Gerrit-PatchSet: 1
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to