javascriptgoogle-chromesource-maps

Load separate sourcemap file in chrome dev tools


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


Solution

  • August 2022, Chrome 104:

    1. Open Chrome Dev Tools
    2. Go to "Sources" tab
    3. Find the .js file you are looking for. Click on it.
    4. Right click somewhere ON THE SOURCE.
    5. Find "Add source map..." option there.

    enter image description here

    (I first wrote this as a comment to the other answer, but @christian-vincenzo-traina suggested having it as a separate answer.)