-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Source maps not working with Firefox #681
Comments
Would be very interested in that fix because Browserify code is basically not debuggable in Firefox right now. |
@graue this looks like it's actually a bug in firefox, it should work. However as a workaround you could use convert-source-map to fix them manually or the higher level mold-source-map which was made exactly for that purpose - specifically see this example. Additionally could you please file a bug with firefox and link it here? Thanks. |
@thlorenz: This is not a Firefox bug. The source should be (and is being) resolved against the source map location. If the source map is hosted anywhere but |
@michaelficarra ok, I wasn't aware of that. However browserify sourcemaps include the Does it still matter then? |
Can anyone else confirm running into the bug I described? @486 ? I've been unsuccessful reproducing this bug with a different project. What I described above was with a work codebase that I unfortunately can't open-source. This small test-case is using the same version of Browserify, has similar absolute paths for the So I'm very confused as to what may be different and why only one project would (consistently!) trigger this bug. |
Here's the full error I get in Firefox's Debugger window with the bug (part of the file path redacted):
Poking around in the Firefox devtools source has only left me more confused, since the line throwing the error apparently only executes if the source map has a |
@graue are you including |
I have been using the browserify-grunt task to build. To make sure that this is not the problem, I made a build directly with browserify: My project structure is: Base path: ~/IdeaProjects/cdk-umbrella/cdk/client/src From src folder, I execute:
The built file is served via connect on a vhost with the name www.examplecdk.tld. I made a sample html where the built file is loaded.
One interesting thing to note:
Note that "-cdk.tld" is absent. |
Hi, I'm having the same problem, and thought I'd chime in here. It looks like Firefox has some issue using the I was able to work around this problem by using mold-source-map to change the paths to relative file paths. The actual paths didn't matter, as long as they were relative. |
I just had the same problem in FF Aurora 30a2, using mold-source-map did the trick: brfs.bundle({ debug: true })
.pipe(mold.transformSourcesRelativeTo(__dirname)) In my case I was serving a browserified file so I was using browserify programmatically. |
Ran into this problem on Firefox 29.0.1- @adamfaulkner @kirbysayshi - thanks, your fix also worked for me using gulp and https://github.com/thlorenz/mold-source-map Additionally - although you can see the code in Chrome - the sources include the full path Screen shots from https://github.com/aliwatters/sandbox/tree/master/2014/20140526-browserify-jquery |
@substack Any update on this? Is |
yeah, interested as well. the solution gets me past the error, but source maps are still not functioning in FF. |
any updates on this ? |
Read this thread, and still not sure why this is happening. Is nobody debugging in Firefox or something? |
Hmmm what's the deal with this? Still broken for me. mold-source-map isn't giving me source maps, but maybe my paths are wrong? |
Don't know whether it's useful information but WebPack doesn't seem to have this issue |
👍 |
I'm getting this error in Firefox 33.0.2:
I thought it was an issue with the base64 encoded source-map, so I used exorcist to take it out into another file, but still the same error is being shown for my main |
@kumarharsh get same error with |
Yes, I can confirm it works with Chrome. But in firefox, the |
I get the same debugger error..
..in Firefox Developer Edition 35.0a2 (2014-11-14), and no mapping in console messages. |
I suspect this is https://bugzilla.mozilla.org/show_bug.cgi?id=1090768 / mozilla/source-map#145 and if so should be fixed in 36+ If anyone can still reproduce in Nightly, please file a bug with the test case: https://bugzilla.mozilla.org/enter_bug.cgi?product=Firefox&component=Developer%20Tools%3A%20Debugger |
Removing my home folder path from [preludePath and row.sourceFile] in sourcemap.addFile(
{ sourceFile: preludePath, source: prelude },
{ line: 0 }
);
...
sourcemap.addFile(
{ sourceFile: row.sourceFile, source: row.source },
{ line: lineno }
); |
I'm not sure why Firefox would fetch the content when they're included already, and the linked bug suggests it's fixed in Firefox 37. A PR can probably be opened up against |
I believe this is still a bug in our end of the Firefox debugger. Looks like we aren't correctly checking the inlined source content of the sourcemap. I will fix this. See https://bugzilla.mozilla.org/show_bug.cgi?id=1166048 Note that the source URLs included in a browserify sourcemap do have a bug though: a file URL is include like |
What values are you referring to, the elements of
Do you mean browserify? |
@jlongster Ah yeah don't set a sourceRoot. That's an easy fix. We already pass it to browser-pack, but don't do anything with it there. I'll test it later and merge a fix. |
I'm not sure there's actually a bug here. I think the |
@jmm looking at the source map spec, i think you're right:
so source root is optional.
and the default behavior is sane. though we should use |
I haven't looked into it, but if browser-pack is supposed to accept a As long as browserify is generating source maps |
Yup and yup.
It should just be an option. I'll add it in browser-pack |
I previously said:
In case this comes up again in the future, I can't think of a reason for |
This issue has become too dated and muddled to be actionable at this point and there's at least one open bug on Firefox that may be the problem. Also, I don't know when it changed, but by default browserify currently generates source maps with relative If it seems to be a Firefox bug, please follow up there. Otherwise, please open a new issue here with a minimal reproduction in a repo and any other relevant information, such as Firefox version. See: |
Looks like this problem was just fixed by Firefox in version 42.0a2. (Download the FirefoxDeveloperEdition) |
Firefox has partial support for source maps. The Console tab doesn't use them yet, but ClojureScript's source maps are working fine for me in the Debugger tab. Browserify's do not.
The issue seems to be full pathnames in the source map's "sources" key:
If I remove the beginnings of each path so all the pathnames are relative to the project root, e.g.
then base64-encode the modified source map and stick it back into the Browserify bundle, Firefox's debugger is happy (and Chrome's still is, too).
I've done this manually but may be able to work on a PR for this later, if making Browserify use relative paths is seen as an acceptable change and the best way to go here. Let me know if that sounds like a good plan.
The text was updated successfully, but these errors were encountered: