From 27b5b9f316fbde3ca036a3384e01b596ce154c0d Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Tue, 18 Oct 2016 01:45:12 +0100 Subject: [PATCH] fix(build): add react minification support Fix #2110 --- .../angular-cli/models/webpack-build-common.ts | 1 + .../models/webpack-build-development.ts | 9 --------- .../angular-cli/models/webpack-build-production.ts | 14 ++++---------- packages/angular-cli/models/webpack-build-test.js | 4 +++- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/packages/angular-cli/models/webpack-build-common.ts b/packages/angular-cli/models/webpack-build-common.ts index 1a94f030eef3..aae14af6663c 100644 --- a/packages/angular-cli/models/webpack-build-common.ts +++ b/packages/angular-cli/models/webpack-build-common.ts @@ -139,6 +139,7 @@ export function getWebpackCommonConfig( crypto: 'empty', tls: 'empty', net: 'empty', + process: true, module: false, clearImmediate: false, setImmediate: false diff --git a/packages/angular-cli/models/webpack-build-development.ts b/packages/angular-cli/models/webpack-build-development.ts index 4dbaf65e116b..ed5305df709f 100644 --- a/packages/angular-cli/models/webpack-build-development.ts +++ b/packages/angular-cli/models/webpack-build-development.ts @@ -8,15 +8,6 @@ export const getWebpackDevConfigPartial = function(projectRoot: string, appConfi filename: '[name].bundle.js', sourceMapFilename: '[name].map', chunkFilename: '[id].chunk.js' - }, - node: { - fs: 'empty', - global: true, - crypto: 'empty', - process: true, - module: false, - clearImmediate: false, - setImmediate: false } }; }; diff --git a/packages/angular-cli/models/webpack-build-production.ts b/packages/angular-cli/models/webpack-build-production.ts index cce93ab7868a..3ff408ad9a07 100644 --- a/packages/angular-cli/models/webpack-build-production.ts +++ b/packages/angular-cli/models/webpack-build-production.ts @@ -24,6 +24,9 @@ export const getWebpackProdConfigPartial = function(projectRoot: string, appConf }, plugins: [ new WebpackMd5Hash(), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('production') + }), new webpack.optimize.UglifyJsPlugin({ mangle: { screw_ie8 : true }, compress: { screw_ie8: true }, @@ -54,15 +57,6 @@ export const getWebpackProdConfigPartial = function(projectRoot: string, appConf ] } }) - ], - node: { - fs: 'empty', - global: true, - crypto: 'empty', - process: true, - module: false, - clearImmediate: false, - setImmediate: false - } + ] }; }; diff --git a/packages/angular-cli/models/webpack-build-test.js b/packages/angular-cli/models/webpack-build-test.js index 2aef8b397940..9d3262f30138 100644 --- a/packages/angular-cli/models/webpack-build-test.js +++ b/packages/angular-cli/models/webpack-build-test.js @@ -111,8 +111,10 @@ const getWebpackTestConfig = function (projectRoot, environment, appConfig) { node: { fs: 'empty', global: true, - process: false, crypto: 'empty', + tls: 'empty', + net: 'empty', + process: true, module: false, clearImmediate: false, setImmediate: false