Skip to content

code from source-map-loader is possibly ending up in the bundle #22998

Closed
@chrisguttandin

Description

@chrisguttandin

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: v12.x

Description

Producing a production bundle with enabled source maps causes the source-map-loader package itself to appear in the bundle. I think this is rather confusing since source-map-loader is a webpack loader which should only be used at build time.

I'm not sure though if some code of source-map-loader actually ends up in the bundle or the source maps are just wrongly pointing to it. Interestingly source-map-loader is not part of the source maps anymore with optimization turned off.

🔬 Minimal Reproduction

npx @angular/cli new example
cd example/
ng build --source-map

🔥 Exception or Error

The main.hash.js.map file has a reference to "./node_modules/source-map-loader/dist/cjs.js".

🌍 Your Environment


Angular CLI: 13.3.3
Node: 16.14.2
Package Manager: npm 8.5.2
OS: darwin arm64

Angular: 13.3.3
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1303.3
@angular-devkit/build-angular   13.3.3
@angular-devkit/core            13.3.3
@angular-devkit/schematics      13.3.3
@schematics/angular             13.3.3
rxjs                            7.5.5
typescript                      4.6.3

Anything else relevant?

Running ng build with disabled optimization (ng build --source-map --optimization=false) will produce source maps which don't include a reference to the source-map-loader package.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions