@@ -205,6 +205,9 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
205205 alias = rxPaths ( nodeModules ) ;
206206 } catch { }
207207
208+ const isIvyEnabled = wco . tsConfig . raw . angularCompilerOptions
209+ && wco . tsConfig . raw . angularCompilerOptions . enableIvy ;
210+
208211 const uglifyOptions = {
209212 ecma : wco . supportES2015 ? 6 : 5 ,
210213 warnings : ! ! buildOptions . verbose ,
@@ -215,20 +218,27 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
215218 webkit : true ,
216219 } ,
217220
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+ } ,
229239 } ) ,
230240 // We also want to avoid mangling on server.
231- ...( buildOptions . platform == 'server' ? { mangle : false } : { } )
241+ ...( buildOptions . platform == 'server' ? { mangle : false } : { } ) ,
232242 } ;
233243
234244 return {
0 commit comments