- /**
- * Plugin: CompressionPlugin
- * Description: Prepares compressed versions of assets to serve
- * them with Content-Encoding
- *
- * See: https://github.com/webpack/compression-webpack-plugin
- */
- // new CompressionPlugin({
- // regExp: /\.css$|\.html$|\.js$|\.map$/,
- // threshold: 2 * 1024
- // })
-
- ],
-
- /**
- * Static analysis linter for TypeScript advanced options configuration
- * Description: An extensible linter for the TypeScript language.
- *
- * See: https://github.com/wbuchwalter/tslint-loader
- */
- tslint: {
- emitErrors: true,
- failOnHint: true,
- resourcePath: 'src'
- },
-
- /**
- * Html loader advanced options
- *
- * See: https://github.com/webpack/html-loader#advanced-options
- */
- // TODO: Need to workaround Angular 2's html syntax => #id [bind] (event) *ngFor
- htmlLoader: {
- minimize: true,
- removeAttributeQuotes: false,
- caseSensitive: true,
- customAttrSurround: [
- [/#/, /(?:)/],
- [/\*/, /(?:)/],
- [/\[?\(?/, /(?:)/]
+ beautify: false, // prod
+ output: {
+ comments: false
+ }, // prod
+ mangle: {
+ screw_ie8: true
+ }, // prod
+ compress: {
+ screw_ie8: true,
+ warnings: false,
+ conditionals: true,
+ unused: true,
+ comparisons: true,
+ sequences: true,
+ dead_code: true,
+ evaluate: true,
+ if_return: true,
+ join_vars: true,
+ negate_iife: false // we need this for lazy v8
+ }
+ }),
+
+ new NormalModuleReplacementPlugin(
+ /angular2-hmr/,
+ helpers.root('config/empty.js')
+ ),
+
+ new NormalModuleReplacementPlugin(
+ /zone\.js(\\|\/)dist(\\|\/)long-stack-trace-zone/,
+ helpers.root('config/empty.js')
+ ),
+
+ new HashedModuleIdsPlugin(),
+
+ /**
+ * Plugin: IgnorePlugin
+ * Description: Don’t generate modules for requests matching the provided RegExp.
+ *
+ * See: http://webpack.github.io/docs/list-of-plugins.html#ignoreplugin
+ */
+
+ // new IgnorePlugin(/angular2-hmr/),
+
+ /**
+ * Plugin: CompressionPlugin
+ * Description: Prepares compressed versions of assets to serve
+ * them with Content-Encoding
+ *
+ * See: https://github.com/webpack/compression-webpack-plugin
+ */
+ // install compression-webpack-plugin
+ // new CompressionPlugin({
+ // regExp: /\.css$|\.html$|\.js$|\.map$/,
+ // threshold: 2 * 1024
+ // })
+
+ /**
+ * Plugin LoaderOptionsPlugin (experimental)
+ *
+ * See: https://gist.github.com/sokra/27b24881210b56bbaff7
+ */
+ new LoaderOptionsPlugin({
+ minimize: true,
+ debug: false,
+ options: {
+
+ /**
+ * Static analysis linter for TypeScript advanced options configuration
+ * Description: An extensible linter for the TypeScript language.
+ *
+ * See: https://github.com/wbuchwalter/tslint-loader
+ */
+ tslint: {
+ emitErrors: true,
+ failOnHint: true,
+ resourcePath: 'src'
+ },
+
+ /**
+ * Html loader advanced options
+ *
+ * See: https://github.com/webpack/html-loader#advanced-options
+ */
+ // TODO: Need to workaround Angular 2's html syntax => #id [bind] (event) *ngFor
+ htmlLoader: {
+ minimize: true,
+ removeAttributeQuotes: false,
+ caseSensitive: true,
+ customAttrSurround: [
+ [/#/, /(?:)/],
+ [/\*/, /(?:)/],
+ [/\[?\(?/, /(?:)/]
+ ],
+ customAttrAssign: [/\)?]?=/]
+ },
+
+ // FIXME: Remove
+ // https://github.com/bholloway/resolve-url-loader/issues/36
+ // https://github.com/jtangelder/sass-loader/issues/289
+ context: __dirname,
+ output: {
+ path: helpers.root('dist')
+ }
+ }
+ })