-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Labels
area: @angular/buildfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity3: brokentype: bug/fix
Description
Command
build
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
When setting build.options.sourceMap.hidden to true, there is two cases I've seen where //# sourceMappingURL= is still added to the bottom of the file: any scripts files added as worker, and for style files specified in build.options.styles. I cannot find a way to make all emitted files respect the hidden flag for sourcemaps.
Minimal Reproduction
- Generate a new Angular project:
npx @angular/cli@latest new --style=css --ssr=false ng-repro
- Add
angular.jsonconfig to use hidden sourcemaps: - Add a worker file at
src/main.worker.ts:globalThis.postMessage('Hello! I am a worker!');
- Import the worker in
main.ts, by adding this at the bottom:const worker = new Worker(new URL('./main.worker', import.meta.url)); worker.addEventListener('message', e => console.log(e.data));
- Run the build step:
npm run build
By checking styles-<hash>.css and worker-<hash>.js in the dist/<project>/browser folder, we can see that at the bottom of both files there is a //# sourceMappingURL= mapping, and thus the sourcemap is not hidden.
Exception or Error
No response
Your Environment
Angular CLI: 18.0.3
Node: 22.2.0
Package Manager: npm 10.7.0
OS: win32 x64
Angular: 18.0.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1800.3
@angular-devkit/build-angular 18.0.3
@angular-devkit/core 18.0.3
@angular-devkit/schematics 18.0.3
@angular/cli 18.0.3
@schematics/angular 18.0.3
rxjs 7.8.1
typescript 5.4.5
zone.js 0.14.7
Anything else relevant?
No response
Metadata
Metadata
Assignees
Labels
area: @angular/buildfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity3: brokentype: bug/fix