Firefox cannot load the .map file that a script points to
Fix it fast
Most common cause, 1 of 2A copied or concatenated library file kept its sourceMappingURL comment
Import the library from your entry file so the bundler produces one map for the whole bundle.
// resources/js/app.js: bundle it instead of copying dist files
import 'bootstrap'
# or remove the stale comment from a copied file
sed -i.bak '/sourceMappingURL=/d' public/js/vendor.jsShort answer
Firefox prints Source map error with request failed with status 404 when a script ends in a //# sourceMappingURL comment and the server has no file at that URL. The page still works; only debugging loses the original code. Deploy the .map file, remove the stray comment, or build hidden source maps. Applies to Firefox, webpack 5.113 and Vite 8.3.
Which cause do you have?
Compare the two URLs Firefox prints under the error. Then fetch the end of the script named as Resource URL to see the comment, and ask the server for the map it names. A library's map name (such as bootstrap.js.map) under your own bundle points to cause 1; your bundle's own name with .map added points to cause 2.
curl -s https://example.com/js/app.js | tail -c 300 | grep -o "sourceMappingURL=.*"
curl -sI https://example.com/js/bootstrap.js.map | head -n 1Then find the line you see in this list and open its fix:
- 1A copied or concatenated library file kept its sourceMappingURL comment
Source Map URL names a library's map, such as bootstrap.js.map, while Resource URL is a file your build produced or copied - 2The bundler writes maps, but the deploy leaves them out
Source Map URL is your own bundle's name plus .map (app.js.map), the map exists in the local build folder, and it is missing on the server
What does the error look like?
request failed with status 404Resource URL: https://example.com/js/app.jsSource Map URL: bootstrap.js.map
Cause 1 of 2
A copied or concatenated library file kept its sourceMappingURL comment
You seeSource Map URL names a library's map, such as bootstrap.js.map, while Resource URL is a file your build produced or copied
Check
Firefox's source map loader requests the URL from the script's comment and raises request failed with status 404 when the server answers 404. Under the source map standard, a relative URL in that comment is resolved against the script's own location. A build step that copies a library's dist file, or glues several files into one without writing a new map, leaves the library's last-line comment in place, pointing at a map that was never copied.
grep -n "sourceMappingURL" public/js/*.jsFix
Import the library from your entry file so the bundler produces one map for the whole bundle. If you must ship the copied file, copy its .map beside it, or delete the comment line from the copy.
// resources/js/app.js: bundle it instead of copying dist files
import 'bootstrap'
# or remove the stale comment from a copied file
sed -i.bak '/sourceMappingURL=/d' public/js/vendor.jsVerify
The map URL now answers 200, or the comment is gone and Firefox stops asking for it.
grep -c "sourceMappingURL" public/js/vendor.jsConfirmed by tc39.es
Cause 2 of 2
The bundler writes maps, but the deploy leaves them out
You seeSource Map URL is your own bundle's name plus .map (app.js.map), the map exists in the local build folder, and it is missing on the server
Check
webpack's source-map setting and Vite's build.sourcemap: true both write a separate .map file and add a comment that points to it. When the upload copies only .js and .css files, or the server refuses .map requests, every visitor's DevTools asks for a file that is not there. webpack's documentation also warns against letting normal users download full maps, since they expose your original code.
ls dist/assets/*.map 2>/dev/null | head -n 3
curl -sI https://example.com/assets/app.js.map | head -n 1Fix
Either upload the maps on purpose, or build hidden maps: the files are still written for your error-reporting tool, but the bundle carries no comment, so browsers never request them. Turning maps off for production also works.
// webpack.config.js
module.exports = { devtool: 'hidden-source-map' };
// vite.config.js
export default { build: { sourcemap: 'hidden' } };Verify
After a rebuild the bundles contain no sourceMappingURL comment, so Firefox has nothing to fetch.
grep -c "sourceMappingURL" dist/assets/*.jsConfirmed by webpack.js.org
How do I stop it coming back?
- Choose one source map policy per environment: hidden maps for production error tracking, full maps on staging only.
- Pull third-party libraries in through imports rather than copying their dist files next to your bundle.
- Add a deploy check that requests every sourceMappingURL named in the built files and fails on a 404.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.