Skip to content

Locally linked UMD bundles break runtime when producing source maps #20182

@smasala

Description

@smasala

🐞 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?

Breaking change: d71ee21#diff-f3bcbd6f6b0756d2178dd69396750fa742093fb7f4668ab284463c0ca348b032R370

Description

List a local js/umd built package in the package.json and run npm i so it creates a symbolic link in node_modules and not a copy.

Causes chunks to be generated with undefinedundefinedundefinedundefined inserted into the bottom of the build output which obviously break the whole thing on runtime.

Workarounds

  1. Disable source map generation (i.e production mode)

  2. (Best option) npm pack the module and list the tar in the package.json instead so that the module is copied and not linked.

  3. Other fix (by far not recommended):

// adding vendorSourceMap in @angular-devkit/build-angular/src/webpack/configs/common.js fixes it
if ((scriptsSourceMap || stylesSourceMap) && vendorSourceMap) {
// --- OR ---
// add the origin folder (in this case 'vendor') to exclude regex
exclude: vendorSourceMap
                ? /(ngfactory|ngstyle)\.js$/
                : [/[\\\/]node_modules[\\\/]/, /[\\\/]vendor[\\\/]/, /(ngfactory|ngstyle)\.js$/],

🔬 Minimal Reproduction

Apart from a zoom call, can't really reproduce as it's a purchased commercial module in use.

🔥 Exception or Error





🌍 Your Environment





Anything else relevant?

Metadata

Metadata

Assignees

Labels

needs: repro stepsWe cannot reproduce the issue with the information given

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions