File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed
packages/angular_devkit/build_angular/src
angular-cli-files/models/webpack-configs Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
2323import { RawSource } from 'webpack-sources' ;
2424import { AssetPatternClass , ExtraEntryPoint } from '../../../browser/schema' ;
2525import { BuildBrowserFeatures , fullDifferential } from '../../../utils' ;
26+ import { manglingDisabled } from '../../../utils/mangle-options' ;
2627import { BundleBudgetPlugin } from '../../plugins/bundle-budget' ;
2728import { CleanCssWebpackPlugin } from '../../plugins/cleancss-webpack-plugin' ;
2829import { NamedLazyChunksPlugin } from '../../plugins/named-chunks-plugin' ;
@@ -362,6 +363,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
362363 // We also want to avoid mangling on server.
363364 // Name mangling is handled within the browser builder
364365 mangle :
366+ ! manglingDisabled &&
365367 buildOptions . platform !== 'server' &&
366368 ( ! differentialLoadingNeeded || ( differentialLoadingNeeded && fullDifferential ) ) ,
367369 } ;
Original file line number Diff line number Diff line change 1+ /**
2+ * @license
3+ * Copyright Google Inc. All Rights Reserved.
4+ *
5+ * Use of this source code is governed by an MIT-style license that can be
6+ * found in the LICENSE file at https://angular.io/license
7+ */
8+ const mangleVariable = process . env [ 'NG_BUILD_MANGLE' ] ;
9+ export const manglingDisabled =
10+ ! ! mangleVariable && ( mangleVariable === '0' || mangleVariable . toLowerCase ( ) === 'false' ) ;
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import * as fs from 'fs';
99import * as path from 'path' ;
1010import { SourceMapConsumer , SourceMapGenerator } from 'source-map' ;
1111import { minify } from 'terser' ;
12+ import { manglingDisabled } from './mangle-options' ;
1213
1314const { transformAsync } = require ( '@babel/core' ) ;
1415const cacache = require ( 'cacache' ) ;
@@ -134,7 +135,7 @@ async function processWorker(options: ProcessBundleOptions): Promise<void> {
134135 const result = minify ( code , {
135136 compress : false ,
136137 ecma : 5 ,
137- mangle : true ,
138+ mangle : ! manglingDisabled ,
138139 safari10 : true ,
139140 toplevel : true ,
140141 output : {
@@ -184,7 +185,7 @@ async function mangleOriginal(options: ProcessBundleOptions): Promise<void> {
184185 const resultOriginal = minify ( options . code , {
185186 compress : false ,
186187 ecma : 6 ,
187- mangle : true ,
188+ mangle : ! manglingDisabled ,
188189 safari10 : true ,
189190 output : {
190191 ascii_only : true ,
You can’t perform that action at this time.
0 commit comments