I am getting warnings like DevTools failed to load SourceMap: Could not parse content for http://localhost:8000/index.js.map: Unexpected token < in JSON at position 0
where chrome is trying to a fetch a source map that doesn't exist. Why has chrome decided there should be a source map in this case and how can I prevent it from doing so?
Asked
Active
Viewed 1,827 times
4

Max888
- 3,089
- 24
- 55
1 Answers
4
Source maps are indicated by having a special comment at the end of the file, as described at MDN:
//# sourceMappingURL=http://example.com/path/to/your/sourcemap.map
So there is likely a line like this in your index.js file:
//# sourceMappingURL=index.js.map
You will need to remove this line (I imagine this may consist of disabling source map generation in your build process) if you would like to get rid of the error for your particular assets. If you want to disable source maps in general, you can do the following, quoted from another post:
Open Developer Tools, go to "Settings" for Developer Tools, then uncheck Enable JavaScript Sourcemaps under the "Sources" settings.

lisaah
- 623
- 1
- 4
- 14