Skip to content
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

Coffeeify sourcemaps have absolute paths to original source #29

Closed
PatrickKing opened this issue Jan 13, 2015 · 6 comments
Closed

Coffeeify sourcemaps have absolute paths to original source #29

PatrickKing opened this issue Jan 13, 2015 · 6 comments

Comments

@PatrickKing
Copy link

The sourcemaps generated by coffeeify have an absolute path to the original .coffee file, which breaks source loading.

I've made a sample app demonstrating the problem. After checking out:

npm install
npm run bundle

... open index.html in a browser, and look at the javascript sources. Chrome actually will follow the absolute path to bar.coffee, but Firefox will fail to load the source.

The (base64 decoded) sources portion of the sourcemap looks like:

"sources":[
  "../../../../usr/local/lib/node_modules/browserify/node_modules/browser-pack/_prelude.js",
  "app.js",
  "/Users/kingp/Projects/coffeeify_bug_submission/bar.coffee",
  "foo.js"
],

Manually changing the absolute path to just bar.coffee fixes the problem.

@PatrickKing
Copy link
Author

After looking into this further:

  1. I didn't fully understand how sourcemaps were being generated and used. Coffeeify (and Browserify) include the original source inline with the source map in the sourcesContent part of the sourcemap, and the sources paths are not used in this case.

  2. It looks like my sample app's failing behaviour in Firefox is due to a bug, where Firefox will ignore the inline source and attempt to load source from the source paths but only for sources paths that are absolute.

  3. The behaviour in Coffeeify is still wrong, though. In the example app I posted, the module in foo.js has a relative sources path generated by Browserify, while the module in bar.coffee has an absolute path as generated by Coffeeify. They should both be relative paths.

@jnordberg
Copy link
Owner

Is this still an issue as of 1.1.0?

@piotrd
Copy link

piotrd commented Apr 28, 2015

@PatrickKing ^, I'm also interested if this is still an issue.

@PatrickKing
Copy link
Author

@jnordberg , @piotrd

Gave my test application another run with coffeeify@1.1.0 and Firefox 37.0.2.

Firefox still isn't resolving the sourcemap for bar.coffee (though commenters in this issue suggest that this might be fixed)

Sources section of the sourcemap produced by Coffeeify still has that absolute path.

"sources":
[
    "../../../../usr/local/lib/node_modules/browserify/node_modules/browser-pack/_prelude.js",
    "app.js",
    "/Users/kingp/Projects/coffeeify_bug_2/bar.coffee",
    "foo.js"
]

So, nothing has changed.

jnordberg added a commit that referenced this issue Nov 20, 2015
@jnordberg
Copy link
Owner

I've pushed a fix to master (not on npm yet). Please test it and let me know if it solved your problems

@jnordberg
Copy link
Owner

2.0.0 is on npm now, closing this. Let me know if you have any problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants