4

I generate source maps for javascript files during minification. The map files are referenced using a relative URL from the minified JS files that sit next to the map files. Here is an example comment at the end of app-e47a6637.js:

//# sourceMappingURL=app-e47a6637.js.map

The source map resolution works as expected in Firefox. However, Chrome does not load the map files.

Additional information:

  • JS source maps are of course enabled in the settings.
  • I tried putting a proxy between Chrome and the server. Chrome does not even request the map files.
  • I use gulp-sourcemaps to generate the map files.
  • I don't want to use the workspace feature of Chrome. I just want it to display the original source files.

How can I enable source maps in Chrome?

theDmi
  • 17,546
  • 6
  • 71
  • 138
  • Are your sourcemaps being served? ( can you view them if you point your browser directly at them? ) Another thing you might try is an 'empty cache and hard reload' I've noticed chrome seems to cache source stuff pretty deep. – BenJamin Dec 07 '15 at 16:57
  • @BenJamin Yes they are, otherwise it wouldn't work in Firefox. I can download the map files in both FF and Chrome. Clearing the cache also did not improve the situation. – theDmi Dec 08 '15 at 07:21
  • is the Source Map URL correct? – BenJamin Dec 08 '15 at 21:53
  • @BenJamin I don't know if you saw my comment: "... otherwise it wouldn't work in Firefox. I can download the map files in both FF and Chrome." So yes, the URL is correct. – theDmi Dec 09 '15 at 08:13
  • In the web inspector, under settings, is "Enable JavaScript source maps" checked? – casraf Dec 09 '15 at 08:20
  • @casraf Yes, it says so in the question text. – theDmi Dec 09 '15 at 08:22
  • I mean does the sourceMappingURL in the source file have the correct path relative to the source file. – BenJamin Dec 10 '15 at 22:41
  • This worked for me http://stackoverflow.com/a/33488335/560287 – John Magnolia Dec 20 '16 at 22:28

0 Answers0