Is it possible to add a local SourceMap? I have a Website, which I cannot modify, containing compressed (closure) JavaScript. I have a local JavaScript-SourceMap belonging to that file. Is there any way to tell GoogleChrome (or any other browser) to add a SourceMap before/after the page loads?
-
See developers.google.com/chrome-developer-tools/docs/… for how the location of the source map is found.Barmar– Barmar2014-02-11 16:51:24 +00:00Commented Feb 11, 2014 at 16:51
-
I don't think you can reference local files there?agrafix– agrafix2014-02-11 19:12:04 +00:00Commented Feb 11, 2014 at 19:12
-
1Maybe you can use a Chrome extension to intercept the HTTP request for the JavaScript and insert the X-SourceMap header? Still not sure if it will work with a file:// URL though :(Tyler– Tyler2014-02-15 18:18:40 +00:00Commented Feb 15, 2014 at 18:18
Add a comment
|
1 Answer
You cannot point to file containing the map. You can however host your map locally and then point to localhost address. In the javascript source file there also must not be
//# sourceMappingURL=...
comment presented since than Chrome DevTools won't load the sourcemap if it is different than specified in the URL.
4 Comments
KennyXu
in chrome you can right click the source file and select add source map...
Kazuki
@KennyXu Do you know if it's still available? I cannot see UI to add sourcemap
Mike Stapp
@Kazuki In the Sources tab, select the bundled .js file you want (e.g. app.js), then right click in the pane showing that bundled file's source code. That's where you'll see the "Add source map..." option.
Kazuki
Ahh, I was right clicking on the filename. It seems right clicking on the source code was the key. Thanks for help.