@@ -205,6 +205,9 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
205
205
alias = rxPaths ( nodeModules ) ;
206
206
} catch { }
207
207
208
+ const isIvyEnabled = wco . tsConfig . raw . angularCompilerOptions
209
+ && wco . tsConfig . raw . angularCompilerOptions . enableIvy ;
210
+
208
211
const uglifyOptions = {
209
212
ecma : wco . supportES2015 ? 6 : 5 ,
210
213
warnings : ! ! buildOptions . verbose ,
@@ -215,20 +218,27 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
215
218
webkit : true ,
216
219
} ,
217
220
218
- // On server, we don't want to compress anything.
219
- ...( buildOptions . platform == 'server' ? { } : {
220
- compress : {
221
- pure_getters : buildOptions . buildOptimizer ,
222
- // PURE comments work best with 3 passes.
223
- // See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926.
224
- passes : buildOptions . buildOptimizer ? 3 : 1 ,
225
- // Workaround known uglify-es issue
226
- // See https://github.com/mishoo/UglifyJS2/issues/2949#issuecomment-368070307
227
- inline : wco . supportES2015 ? 1 : 3 ,
228
- }
221
+ // On server, we don't want to compress anything. We still set the ngDevMode = false for it
222
+ // to remove dev code.
223
+ compress : ( buildOptions . platform == 'server' ? {
224
+ global_defs : {
225
+ ngDevMode : false ,
226
+ } ,
227
+ } : {
228
+ pure_getters : buildOptions . buildOptimizer ,
229
+ // PURE comments work best with 3 passes.
230
+ // See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926.
231
+ passes : buildOptions . buildOptimizer ? 3 : 1 ,
232
+ // Workaround known uglify-es issue
233
+ // See https://github.com/mishoo/UglifyJS2/issues/2949#issuecomment-368070307
234
+ inline : wco . supportES2015 ? 1 : 3 ,
235
+
236
+ global_defs : {
237
+ ngDevMode : false ,
238
+ } ,
229
239
} ) ,
230
240
// We also want to avoid mangling on server.
231
- ...( buildOptions . platform == 'server' ? { mangle : false } : { } )
241
+ ...( buildOptions . platform == 'server' ? { mangle : false } : { } ) ,
232
242
} ;
233
243
234
244
return {
0 commit comments