complete-node-bootcamp
complete-node-bootcamp copied to clipboard
Could not load content for http://127.0.0.1:8000/bundle.js.map
For no reason the server is trying to load the file from the root even though the file created by the parcel located in the same directory with bundle.js.
The message I get in a console: DevTools failed to load SourceMap: Could not load content for http://127.0.0.1:8000/bundle.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
Here's two lines from the package.json if you're interested in it
"scripts": {
"watch:js": "parcel watch ./public/js/index.js --out-dir ./public/js --out-file bundle.js",
"build:js": "parcel build ./public/js/index.js --out-dir ./public/js --out-file bundle.js"
},
Well, once bundler.js has been compiled if we open it and scroll to the very bottom, there is a line:
//# sourceMappingURL=/bundle.js.map
We can manually type the correct path like
//# sourceMappingURL=/js/bundle.js.map
the error would disappear though the question is why the parcel makes the path this way....
Finally, the solution is found! You should insert --public-url . it'll do the trick!
"watch:js": "parcel watch ./public/js/index.js --out-dir ./public/js --out-file bundle.js --public-url .",
"build:js": "parcel build ./public/js/index.js --out-dir ./public/js --out-file bundle.js --public-url ."