Explorar o código

Add UglifyJS plugin to webpack.config for production client bundle

Vladimir Kutepov %!s(int64=9) %!d(string=hai) anos
pai
achega
35e9bf0994
Modificáronse 1 ficheiros con 12 adicións e 4 borrados
  1. 12 4
      tools/config.js

+ 12 - 4
tools/config.js

@@ -97,10 +97,18 @@ const appConfig = merge({}, config, {
   output: {
     filename: 'app.js'
   },
-  plugins: config.plugins.concat(WATCH ? [
-    new webpack.HotModuleReplacementPlugin(),
-    new webpack.NoErrorsPlugin()
-  ] : [])
+  plugins: [
+    ...config.plugins,
+    ...(DEBUG ? [] : [
+      new webpack.optimize.DedupePlugin(),
+      new webpack.optimize.UglifyJsPlugin({compress: {warnings: VERBOSE}}),
+      new webpack.optimize.AggressiveMergingPlugin()
+    ]),
+    ...(WATCH ? [
+      new webpack.HotModuleReplacementPlugin(),
+      new webpack.NoErrorsPlugin()
+    ] : [])
+  ]
 });
 
 // Configuration for server-side pre-rendering bundle