Client: add optimize plugin
authorChocobozzz <florian.bigard@gmail.com>
Fri, 27 Jan 2017 09:51:26 +0000 (10:51 +0100)
committerChocobozzz <florian.bigard@gmail.com>
Fri, 27 Jan 2017 09:51:33 +0000 (10:51 +0100)
client/config/webpack.prod.js
client/package.json

index 51b8a8855202bc8fccdc2a8b05f8b0f40e183ae7..6d65fcb3739ff3305b9f9358db534dbe7b3f9c86 100644 (file)
@@ -12,6 +12,7 @@ const commonConfig = require('./webpack.common.js') // the settings that are com
 const DefinePlugin = require('webpack/lib/DefinePlugin')
 const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
 const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin')
+const OptimizeJsPlugin = require('optimize-js-plugin')
 const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin')
 const WebpackMd5Hash = require('webpack-md5-hash')
 
@@ -98,6 +99,17 @@ module.exports = function (env) {
        */
       new WebpackMd5Hash(),
 
+      /**
+       * Webpack plugin to optimize a JavaScript file for faster initial load
+       * by wrapping eagerly-invoked functions.
+       *
+       * See: https://github.com/vigneshshanmugam/optimize-js-plugin
+       */
+
+      new OptimizeJsPlugin({
+        sourceMap: false
+      }),
+
       /**
        * Plugin: DedupePlugin
        * Description: Prevents the inclusion of duplicate code into your bundle
index f4835590ee78ed8786767eb64721bab7742c9983..1a04be5bc9b410264ce655b7f785675bd9a5753f 100644 (file)
     "ie-shim": "^0.1.0",
     "intl": "^1.2.4",
     "json-loader": "^0.5.4",
+    "ng-router-loader": "^1.0.2",
     "ng2-bootstrap": "1.1.16-10",
     "ng2-file-upload": "^1.1.4-2",
     "ng2-meta": "https://github.com/chocobozzz/ng2-meta#build",
-    "ng-router-loader": "^1.0.2",
     "ngc-webpack": "1.1.0",
     "node-sass": "^4.1.1",
     "normalize.css": "^5.0.0",
+    "optimize-js-plugin": "0.0.4",
     "raw-loader": "^0.5.1",
     "reflect-metadata": "^0.1.9",
     "resolve-url-loader": "^1.6.0",
@@ -74,7 +75,6 @@
     "tslint-loader": "^3.3.0",
     "typescript": "~2.1.0",
     "url-loader": "^0.5.7",
-    "v8-lazy-parse-webpack-plugin": "^0.3.0",
     "video.js": "^5.11.9",
     "videojs-dock": "^2.0.2",
     "webpack": "2.2.0-rc.3",