Ember.js: dist/ember.prod.js has multiple sourcemap declarations, breaking sourcemap build

Created on 13 Aug 2018  ·  4Comments  ·  Source: emberjs/ember.js

Summary

The current npm version of ember-source, 3.3.1 (2018-09-07 update: issue remains in 3.4.0), contains the file dist/ember.prod.js. This file contains multiple declarations of the form:

    //# sourceMappingURL=FILENAME.js.map

According to the source map spec, there should only be one line of this form, at the end of the file.

Impact

This means any vendor.js file built with ember-cli will not have a valid sourcemap file.

Please see https://github.com/emberjs/ember.js/issues/16844 for the error (the bug was erroneously closed as the issue was assumed to be with ember-cli, not ember-source).

Cause

Including multiple sourceMappingURL declarations in ember.prod.js causes issues for fast-sourcemap-concat (/lib/source-map.js#L91), since the source-map-url library only removes the first one.

This is valid behaviour since there should only be one sourceMappingURL declaration per file.

Suggested fix

Remove the extra sourceMappingURL lines from dist/ember.prod.js.

References and similar issues

https://github.com/broccolijs/broccoli-concat/issues/123
https://github.com/ef4/fast-sourcemap-concat/pull/54
https://github.com/ember-cli/ember-fetch/pull/120

Bug Has Reproduction Regression

Most helpful comment

Bug is still present in latest v3.6.0-beta.1 release. Just search for sourceMappingURL in https://unpkg.com/[email protected]/dist/ember.prod.js for reproduction.

This effectively prevents us from upgrading, because our Sentry stack traces for vendor.js are unparseable. I would love to help fix this, but I know too little about Ember's internal build pipeline. If I could get some pointers of potential sites of interest, I'll start investigating. 🕵️

All 4 comments

Downgrading to v3.2.2 fixes this. v3.3.0-beta.2, the first version on npm after v3.2.2, already exhibits the bug. So it happened somewhere between v3.2.2...v3.3.0-beta.2.

Bug is still present in latest v3.6.0-beta.1 release. Just search for sourceMappingURL in https://unpkg.com/[email protected]/dist/ember.prod.js for reproduction.

This effectively prevents us from upgrading, because our Sentry stack traces for vendor.js are unparseable. I would love to help fix this, but I know too little about Ember's internal build pipeline. If I could get some pointers of potential sites of interest, I'll start investigating. 🕵️

0af67912566b437cd96305af342b7be54fe98097 is the first bad commit
commit 0af67912566b437cd96305af342b7be54fe98097
Author: Robert Jackson rjackson@linkedin.com
Date: Thu Apr 12 13:20:38 2018 -0400

Move error handling code up into standalone package.

This simplifies a possible cycle between ember-metal and @ember/runloop.

Also migrate to typescript...

a day earlier https://github.com/emberjs/ember.js/pull/16482 was merged, which is likely the actual cause of this issue 🤔

Was this page helpful?
0 / 5 - 0 ratings