@@ -30,7 +30,7 @@ import { RawSource } from 'webpack-sources';
30
30
import { AssetPatternClass , ExtraEntryPoint } from '../../../browser/schema' ;
31
31
import { BuildBrowserFeatures } from '../../../utils' ;
32
32
import { findCachePath } from '../../../utils/cache-path' ;
33
- import { cachingDisabled , manglingDisabled } from '../../../utils/environment-options' ;
33
+ import { beautifyEnabled , cachingDisabled , manglingDisabled , minifyDisabled } from '../../../utils/environment-options' ;
34
34
import { BundleBudgetPlugin } from '../../plugins/bundle-budget' ;
35
35
import { NamedLazyChunksPlugin } from '../../plugins/named-chunks-plugin' ;
36
36
import { OptimizeCssWebpackPlugin } from '../../plugins/optimize-css-webpack-plugin' ;
@@ -410,11 +410,13 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
410
410
// default behavior (undefined value) is to keep only important comments (licenses, etc.)
411
411
comments : ! buildOptions . extractLicenses && undefined ,
412
412
webkit : true ,
413
+ beautify : beautifyEnabled ,
413
414
} ,
414
415
// On server, we don't want to compress anything. We still set the ngDevMode = false for it
415
416
// to remove dev code, and ngI18nClosureMode to remove Closure compiler i18n code
416
417
compress :
417
- buildOptions . platform == 'server'
418
+ ! minifyDisabled &&
419
+ ( buildOptions . platform == 'server'
418
420
? {
419
421
ecma : terserEcma ,
420
422
global_defs : angularGlobalDefinitions ,
@@ -427,13 +429,10 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
427
429
// See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926.
428
430
passes : buildOptions . buildOptimizer ? 3 : 1 ,
429
431
global_defs : angularGlobalDefinitions ,
430
- } ,
432
+ } ) ,
431
433
// We also want to avoid mangling on server.
432
434
// Name mangling is handled within the browser builder
433
- mangle :
434
- ! manglingDisabled &&
435
- buildOptions . platform !== 'server' &&
436
- ! differentialLoadingMode ,
435
+ mangle : ! manglingDisabled && buildOptions . platform !== 'server' && ! differentialLoadingMode ,
437
436
} ;
438
437
439
438
extraMinimizers . push (
@@ -457,7 +456,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
457
456
globalScriptsByBundleName . some ( s => s . bundleName === chunk . name ) ,
458
457
terserOptions : {
459
458
...terserOptions ,
460
- compress : {
459
+ compress : ! minifyDisabled && {
461
460
...terserOptions . compress ,
462
461
ecma : 5 ,
463
462
} ,
0 commit comments