Browse Source

Merge pull request #12 from Frenzzy/add-uglify

Add UglifyJS for client bundle
Konstantin Tarkus 9 năm trước cách đây
mục cha
commit
24e8ca9746
1 tập tin đã thay đổi với 12 bổ sung4 xóa
  1. 12 4
      tools/config.js

+ 12 - 4
tools/config.js

@@ -95,10 +95,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