Chrome: Add local JavaScript SourceMap possible?
10,354
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.
Related videos on Youtube
![agrafix](https://i.stack.imgur.com/0bfuS.jpg?s=256&g=1)
Author by
agrafix
Updated on July 13, 2022Comments
-
agrafix almost 2 years
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?
-
Barmar over 10 yearsSee developers.google.com/chrome-developer-tools/docs/… for how the location of the source map is found.
-
agrafix over 10 yearsI don't think you can reference local files there?
-
Tyler over 10 yearsMaybe 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 :(
-
-
KennyXu almost 6 yearsin chrome you can right click the source file and select add source map...
-
Kazuki almost 5 years@KennyXu Do you know if it's still available? I cannot see UI to add sourcemap
-
Mike Stapp almost 5 years@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 almost 5 yearsAhh, I was right clicking on the filename. It seems right clicking on the source code was the key. Thanks for help.