Load separate sourcemap file in chrome dev tools

Greg picture Greg · Dec 4, 2015 · Viewed 12k times · Source

Is it possible to load an external source-map file (JSON), not included in the minified JS file used on a website?

So far the only ways I know of to include a source-map for a particular js file is to either inline it, add a link in comments or set the path in HTTP header.

So I wonder - is it possible to load a source-map file that can't be accessed via HTTP? For instance - load it from my local drive, and point it to the js file it is supposed to be mapping?

Cheers

Answer

Andrey picture Andrey · Feb 9, 2018

I know question is old, but had it myself nevertheless. Here's how you do it in Chromium 63

Add source map

  1. Open Debugger
  2. Right-click in source code area
  3. Select "Add source map…"
  4. Enter URL to source map file
    • if browser is able to download it and process it then sources appear as entry in source tree.

PS built with hidden source (separate files, no source comment)

PPS does not matter where files are hosted, because it is URL. Must be accessible by browser.