Skip to content

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

Closed

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.

Activity

  1. added
    needs: investigation
    on Apr 18, 2022
  2. self-assigned this
    on May 2, 2022
  3. added
    freq1: low
    and removed
    needs: investigation
    on May 2, 2022
  4. modified the milestone: Backlog on May 2, 2022
  5. added a commit that references this issue on May 2, 2022
    6da0910
  6. alan-agius4 commented on May 2, 2022

    @alan-agius4
    Collaborator

    Closed via #23063

  7. chrisguttandin commented on May 4, 2022

    @chrisguttandin
    ContributorAuthor

    Thanks a lot for addressing this, @alan-agius4. 🙏

  8. angular-automatic-lock-bot commented on Jun 4, 2022

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  9. locked and limited conversation to collaborators on Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions