Skip to content

Commit 7ec6703

Browse files
committed
fix(@angular/build): preserve coverage ignore comments in development
When script optimization is disabled, set esbuild `legalComments` to 'inline' to prevent it from moving ignore comments to the end of the file. This ensures that coverage tools (like Istanbul and V8) can find the comments in place and correctly associate them with the code they are supposed to ignore.
1 parent 7fbc715 commit 7ec6703

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/angular/build/src/tools/esbuild/application-code-bundle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ function getEsBuildCommonOptions(options: NormalizedApplicationBuildOptions): Bu
626626
conditions,
627627
resolveExtensions: ['.ts', '.tsx', '.mjs', '.js', '.cjs'],
628628
metafile: true,
629-
legalComments: options.extractLicenses ? 'none' : 'eof',
629+
legalComments: options.extractLicenses ? 'none' : (optimizationOptions.scripts ? 'eof' : 'inline'),
630630
logLevel: options.verbose && !jsonLogs ? 'debug' : 'silent',
631631
minifyIdentifiers: optimizationOptions.scripts && allowMangle,
632632
minifySyntax: optimizationOptions.scripts,

0 commit comments

Comments
 (0)