15

I made some source+map concatenation and result works in Firefox and Chrome, but does not even request bundle.js.map from webserver in MS Edge and IE11.

Actual JS file is served from http://localhost:8080/bundle.js

bundle.js ends with line:

//# sourceMappingURL=bundle.js.map

Tried both end it with new line and without, does not work in both cases. Is there some checklist to look at or even some "validator"?

Bobris
  • 415
  • 1
  • 3
  • 14
  • Is this resource available online for us to investigate the matter further? – Sampson Jan 08 '16 at 22:36
  • 1
    Here you go: http://bobris.github.io/Bobril/sourcemap/index.html – Bobris Jan 08 '16 at 23:03
  • Your source file contains multiple sourcemap comments; remove all but the last one and see if this resolves the issue. – Sampson Jan 09 '16 at 00:16
  • Thanks, Yes that fixes problem ... (even though it should look only at last line comment ...) – Bobris Jan 09 '16 at 00:23
  • Source maps are supposed to be placed at the end of the file (rather than interspersed throughout). I work on the Edge team, and will file a ticket tracking this behavior, but it's unlikely we will be loosening our expectations to accommodate non-standard use of source maps. – Sampson Jan 09 '16 at 00:26
  • May I ask how you wound up having two sourcemap comments? I tested the TypeScript transpiler, and it generated only a single one at the end of the document. – Sampson Jan 09 '16 at 00:53
  • It is my own bundling code. It takes many TypeScript commonjs outputs (each one has its own source map) concatenate then with loader and creates one final source map. So these partial sourcemaps are useless and should not be used. I will need to add code to remove such line from temporary outputs. – Bobris Jan 09 '16 at 08:53
  • Thank you for the additional context and backstory. – Sampson Jan 09 '16 at 09:09

1 Answers1

5

Microsoft Edge expects a single sourcemap comment, located at the end of the file. Your file contains two comments, which appears to cause the issue. Remove all but the final comment, and this should resolve the issue for you.

I will file a ticket to track this issue, but it's unlikely we will modify our implementation to accommodate a non-standard use of sourcemap comments. Thank you for bringing this to our attention though. We'll keep watch to see if this affects other users.

Sampson
  • 265,109
  • 74
  • 539
  • 565
  • I'm having the same problem when using Requirejs. It puts the "require()" line after the sourceMappingURL. Other browsers handle this fine. Would be great if Edge also followed other browsers here. You can see the code at: https://www.w3.org/Tools/respec/respec-w3c-common – Marcosc May 25 '16 at 06:03
  • is there any other reason why Edge might fail to load a source map? I have got a single sourcemap comment located at the end of the file, but I still get a warning " does not conform to the source map v3 specification so we have disabled source mapping". Chrome loads it fine (but not firefox). Any ideas would be helpful – 1800 INFORMATION Sep 02 '20 at 20:12