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
Advertisement
Answer
August 2022, Chrome 104:
- Open Chrome Dev Tools
- Go to “Sources” tab
- Find the
.js
file you are looking for. Click on it. - Right click somewhere ON THE SOURCE.
- Find “Add source map…” option there.
(I first wrote this as a comment to the other answer, but @christian-vincenzo-traina suggested having it as a separate answer.)