Skip to content

Commit 3d9a7ff

Browse files
ishitatsuyukifilipesilva
authored andcommitted
refactor(@angular/cli): use EnvironmentPlugin instead of DefinePlugin
1 parent 698aa3e commit 3d9a7ff

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"@types/rimraf": "0.0.28",
126126
"@types/semver": "^5.3.30",
127127
"@types/source-map": "^0.5.0",
128-
"@types/webpack": "^2.2.4",
128+
"@types/webpack": "^2.2.15",
129129
"chai": "^3.5.0",
130130
"conventional-changelog": "^1.1.0",
131131
"dtsgenerator": "^0.9.1",

packages/@angular/cli/models/webpack-configs/production.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ export const getProdConfig = function (wco: WebpackConfigOptions) {
8282
return {
8383
entry: entryPoints,
8484
plugins: [
85-
new webpack.DefinePlugin({
86-
'process.env.NODE_ENV': JSON.stringify('production')
85+
new webpack.EnvironmentPlugin({
86+
'NODE_ENV': 'production'
8787
}),
8888
new (<any>webpack).HashedModuleIdsPlugin(),
8989
new webpack.optimize.UglifyJsPlugin(<any>{

packages/@angular/cli/tasks/eject.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ class JsonWebpackSerializer {
126126
});
127127
}
128128

129-
_definePlugin(plugin: any) {
130-
return plugin.definitions;
129+
_environmentPlugin(plugin: any) {
130+
return plugin.defaultValues;
131131
}
132132

133133
private _pluginsReplacer(plugins: any[]) {
@@ -172,9 +172,9 @@ class JsonWebpackSerializer {
172172
args = this._htmlWebpackPlugin(plugin);
173173
this.variableImports['html-webpack-plugin'] = 'HtmlWebpackPlugin';
174174
break;
175-
case webpack.DefinePlugin:
176-
args = this._definePlugin(plugin);
177-
this._addImport('webpack', 'DefinePlugin');
175+
case webpack.EnvironmentPlugin:
176+
args = this._environmentPlugin(plugin);
177+
this._addImport('webpack', 'EnvironmentPlugin');
178178
break;
179179

180180
default:

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@
138138
dependencies:
139139
"@types/source-map" "*"
140140

141-
"@types/webpack@^2.2.4":
142-
version "2.2.12"
143-
resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-2.2.12.tgz#5e2ab82b5b43cfadcb308d3210c082cf67fd9893"
141+
"@types/webpack@^2.2.15":
142+
version "2.2.15"
143+
resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-2.2.15.tgz#4ad7e9b7a51cae736a1dc783f203610c884789ff"
144144
dependencies:
145145
"@types/node" "*"
146146
"@types/tapable" "*"

0 commit comments

Comments
 (0)