angular-cli: Locally linked UMD bundles break runtime when producing source maps

🐞 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: https://github.com/angular/angular-cli/commit/d71ee210bf6adcf35b51375de44061fc045421e0#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?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 28

Most upvoted comments

@alan-agius4 You can email me directly and I’ll provide access to our UMD build. mats at bryntum dot com