File tree 3 files changed +15
-2
lines changed
packages/angular_devkit/build_angular/src
angular-cli-files/models/webpack-configs
3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
23
23
import { RawSource } from 'webpack-sources' ;
24
24
import { AssetPatternClass , ExtraEntryPoint } from '../../../browser/schema' ;
25
25
import { BuildBrowserFeatures , fullDifferential } from '../../../utils' ;
26
+ import { manglingDisabled } from '../../../utils/mangle-options' ;
26
27
import { BundleBudgetPlugin } from '../../plugins/bundle-budget' ;
27
28
import { CleanCssWebpackPlugin } from '../../plugins/cleancss-webpack-plugin' ;
28
29
import { NamedLazyChunksPlugin } from '../../plugins/named-chunks-plugin' ;
@@ -362,6 +363,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
362
363
// We also want to avoid mangling on server.
363
364
// Name mangling is handled within the browser builder
364
365
mangle :
366
+ ! manglingDisabled &&
365
367
buildOptions . platform !== 'server' &&
366
368
( ! differentialLoadingNeeded || ( differentialLoadingNeeded && fullDifferential ) ) ,
367
369
} ;
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';
9
9
import * as path from 'path' ;
10
10
import { SourceMapConsumer , SourceMapGenerator } from 'source-map' ;
11
11
import { minify } from 'terser' ;
12
+ import { manglingDisabled } from './mangle-options' ;
12
13
13
14
const { transformAsync } = require ( '@babel/core' ) ;
14
15
const cacache = require ( 'cacache' ) ;
@@ -134,7 +135,7 @@ async function processWorker(options: ProcessBundleOptions): Promise<void> {
134
135
const result = minify ( code , {
135
136
compress : false ,
136
137
ecma : 5 ,
137
- mangle : true ,
138
+ mangle : ! manglingDisabled ,
138
139
safari10 : true ,
139
140
toplevel : true ,
140
141
output : {
@@ -184,7 +185,7 @@ async function mangleOriginal(options: ProcessBundleOptions): Promise<void> {
184
185
const resultOriginal = minify ( options . code , {
185
186
compress : false ,
186
187
ecma : 6 ,
187
- mangle : true ,
188
+ mangle : ! manglingDisabled ,
188
189
safari10 : true ,
189
190
output : {
190
191
ascii_only : true ,
You can’t perform that action at this time.
0 commit comments