Skip to content

Unable to run extract-i18n command due to sourcemapping error #22526

@mattlewis92

Description

@mattlewis92

🐞 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: 12.2.6 (the bug got introduced somewhere in a patch version of v12 as it's present in the latest version of v12 as well as all versions of v13)

Description

When running the extract-i18n command it fails as there is an invalid sourcemap in the dependency tree.

This is what the sourcemap looks like:

{"version":3,"sources":["webpack://[name]/webpack/universalModuleDefinition", ...rest], ...rest}

I'm also going to open an issue with the maintainers of the troublesome dependency to try and get them to fix it on their end, but I guess the CLI should handle invalid sourcemaps rather than crashing like this.

🔬 Minimal Reproduction

git checkout git@github.com:mattlewis92/source-map-bug.git
cd source-map-bug
npm i # Note: the dependency is a private npm dependency, if you can let me know your npm handle then I can grant you access so you can npm install it
npm run extract-i18n

🔥 Exception or Error

./node_modules/@clickup/gantt/codebase/dhtmlxgantt.js - Error: Module build failed (from ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js):
TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:371:5)
    at onParseError (node:internal/url:552:9)
    at new URL (node:internal/url:628:5)
    at normalizeSimplePath (/Users/mattlewis/Code/open-source/source-map-bug/node_modules/@ampproject/remapping/dist/remapping.umd.js:301:26)
    at normalizePath (/Users/mattlewis/Code/open-source/source-map-bug/node_modules/@ampproject/remapping/dist/remapping.umd.js:320:20)
    at resolve (/Users/mattlewis/Code/open-source/source-map-bug/node_modules/@ampproject/remapping/dist/remapping.umd.js:386:26)
    at resolve$1 (/Users/mattlewis/Code/open-source/source-map-bug/node_modules/@ampproject/remapping/dist/remapping.umd.js:418:16)
    at /Users/mattlewis/Code/open-source/source-map-bug/node_modules/@ampproject/remapping/dist/remapping.umd.js:737:25
    at Array.map ()
    at buildSourceMapTree (/Users/mattlewis/Code/open-source/source-map-bug/node_modules/@ampproject/remapping/dist/remapping.umd.js:734:34)

🌍 Your Environment

Angular CLI: 13.1.3
Node: 16.13.1
Package Manager: npm 6.14.15
OS: darwin arm64

Angular: 13.1.2
... animations, common, compiler, compiler-cli, core, elements
... forms, language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1301.2
@angular-devkit/build-angular   13.1.3
@angular-devkit/core            13.1.2
@angular-devkit/schematics      13.1.2
@angular/cdk                    13.1.1
@angular/cli                    13.1.3
@angular/google-maps            12.2.1
@schematics/angular             13.1.3
ng-packagr                      13.1.2
rxjs                            7.4.0
typescript                      4.5.4

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions