-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 sourceMappingURL is not relative to the mapped file #1028
Comments
We write that sourcemap link comment here: parcel/src/packagers/JSPackager.js Lines 204 to 208 in 9858937
I guess your publicURL option is set to For a quick fix, try setting the "scripts": {
"watch": "parcel watch static/app.js -d static/build --public-url /"
} However this should fix it self when PR #838 lands, since it makes |
I didn't set the publicURL manually. My project structure is: /
├── static/ # public directory
│ ├── build/ # files built by Parcel
│ │ ├── app.js
│ │ └── app.map
│ └── app.js # original file
├── package.json
└── server.js The solution is rather Thanks for steering me to the this flag. 👍 |
Well as this is probably more related to #838 than sourcemaps I'll close this down as it's a duplicate and appears to be solved in your case |
@ArthurWhite did you ever find a fix for this? |
@cphoover
|
Thanks, |
So, there is a bug in the parcel-bundler. I was generating the sourcemap with a wrong path, but in reality it should've been relative to the client code. I.e. my bundle in `/public/client.js` but inside that file the last string is a link to the source maps and it was `/client.js.map`, and of course Firefox was unable to find that file. parcel-bundler/parcel#1028
Hi, this issue has bugged me for a round 2 hours today... a complete novice to parcel i thought it was my problem as many tutorials suggest putting your output in a 'dist' folder rather than loose at the root. In the end setting '--public-url /dist/' fixed it for me. Admittedly it is in the docs (https://parceljs.org/cli.html) but I feel like some sort of warning might help. e.g in the minified file it could say 'to change this set the public url..'. Thanks. |
🐛 Bug report
The generated
sourceMappingURL
is a mix of relative and absolute path.Relative to the source file directory, but absolute as it starts with
/
.🎛 Configuration
package.json
🤔 Expected Behavior
//# sourceMappingURL=app.map
😯 Current Behavior
//# sourceMappingURL=/build/app.map
💁 Possible Solution
Use the relative path to the map file (actually, just the file name as it's inside the same directory).
🔦 Context
When my server is configured to serve static (or "public") files under
/static/<filepath>
, the URL ofapp.map
is in fact/static/build/app.map
.So the
sourceMappingURL=/build/app.map
is wrong and results in a "404 Not found" in the browser.🌍 Environment
The text was updated successfully, but these errors were encountered: