Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,9 @@ function getEsBuildCommonOptions(options: NormalizedApplicationBuildOptions): Bu
}
}

const minifySyntax = optimizationOptions.scripts;
const minifyIdentifiers = minifySyntax && allowMangle;

return {
absWorkingDir: workspaceRoot,
format: 'esm',
Expand All @@ -618,9 +621,10 @@ function getEsBuildCommonOptions(options: NormalizedApplicationBuildOptions): Bu
metafile: true,
legalComments: options.extractLicenses ? 'none' : 'eof',
logLevel: options.verbose && !jsonLogs ? 'debug' : 'silent',
minifyIdentifiers: optimizationOptions.scripts && allowMangle,
minifySyntax: optimizationOptions.scripts,
minifyWhitespace: optimizationOptions.scripts,
keepNames: !minifyIdentifiers,
minifyIdentifiers,
minifySyntax,
minifyWhitespace: minifySyntax,
pure: ['forwardRef'],
outdir: workspaceRoot,
outExtension: outExtension ? { '.js': `.${outExtension}` } : undefined,
Expand All @@ -637,7 +641,7 @@ function getEsBuildCommonOptions(options: NormalizedApplicationBuildOptions): Bu
// Only set to false when script optimizations are enabled. It should not be set to true because
// Angular turns `ngDevMode` into an object for development debugging purposes when not defined
// which a constant true value would break.
...(optimizationOptions.scripts ? { 'ngDevMode': 'false' } : undefined),
...(minifySyntax ? { 'ngDevMode': 'false' } : undefined),
'ngJitMode': jit ? 'true' : 'false',
'ngServerMode': 'false',
'ngHmrMode': options.templateUpdates ? 'true' : 'false',
Expand Down
1 change: 1 addition & 0 deletions packages/angular/build/src/tools/vite/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export function getDepOptimizationConfig({
esbuildOptions: {
// Set esbuild supported targets.
target,
keepNames: true,
supported: getFeatureSupport(target, zoneless),
plugins,
loader,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ export default async function () {
message,
// When babel is used it will add names to the sourcemap and `constructor` will be used in the stack trace.
// This will currently only happen if AOT and script optimizations are set which enables advanced optimizations.
/window is not defined[.\s\S]*(?:constructor|_App) \(.*app\.ts\:\d+:\d+\)/,
/window is not defined[.\s\S]*(?:constructor|App) \(.*app\.ts\:\d+:\d+\)/,
);
}