Skip to content

Commit ba3b4ce

Browse files
committed
refactor(@angular-devkit/build-angular): allow NG_BUILD_MANGLE variable with esbuild builder
The development `NG_BUILD_MANGLE` environment variable is now supported when using the esbuild-based browser application builder. This environment variable is intended only for Angular CLI development and test purposes.
1 parent a6c06c4 commit ba3b4ce

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/angular_devkit/build_angular/src/tools/esbuild/application-code-bundle.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { createExternalPackagesPlugin } from '../../tools/esbuild/external-packa
1313
import { createSourcemapIngorelistPlugin } from '../../tools/esbuild/sourcemap-ignorelist-plugin';
1414
import { getFeatureSupport } from '../../tools/esbuild/utils';
1515
import { createVirtualModulePlugin } from '../../tools/esbuild/virtual-module-plugin';
16+
import { allowMangle } from '../../utils/environment-options';
1617

1718
export function createCodeBundleOptions(
1819
options: NormalizedBrowserOptions,
@@ -57,7 +58,9 @@ export function createCodeBundleOptions(
5758
metafile: true,
5859
legalComments: options.extractLicenses ? 'none' : 'eof',
5960
logLevel: options.verbose ? 'debug' : 'silent',
60-
minify: optimizationOptions.scripts,
61+
minifyIdentifiers: optimizationOptions.scripts && allowMangle,
62+
minifySyntax: optimizationOptions.scripts,
63+
minifyWhitespace: optimizationOptions.scripts,
6164
pure: ['forwardRef'],
6265
outdir: workspaceRoot,
6366
outExtension: outExtension ? { '.js': `.${outExtension}` } : undefined,

0 commit comments

Comments
 (0)