Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome: Add local JavaScript SourceMap possible?

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?

like image 991
agrafix Avatar asked Feb 11 '14 16:02

agrafix


People also ask

How do I add source maps to Chrome?

To enable source maps in Google Chrome, go to Developer Tools, click the little cog icon, and then make sure that “Enable Javascript source maps” is checked. That's it.

What is a JavaScript Sourcemap?

Definition. A Sourcemap is a file that maps from the transformed source to the original source. It is a mapping between the generated/transpiled/minified JavaScript file and one or more original source files. The main purpose of Sourcemaps is to aid debugging.


1 Answers

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.

like image 120
JeFf Avatar answered Oct 12 '22 21:10

JeFf