Inline sourcemaps line number mismatching #2861

Closed
Page- opened this Issue Mar 19, 2013 · 9 comments

Comments

Projects
None yet
5 participants

Page- commented Mar 19, 2013

When using coffee-script with inline sourcemaps I have an issue that my mappings seem to be off by one by debugging.
It appears to be caused by 5fb0479, because if I remove the or options.inline then it maps nicely, however I'm confused as the commit message says it fixes them (am I doing something wrong?).

Owner

jashkenas commented Mar 20, 2013

Pinging @jwalton, @hden to take a quick peek.

Contributor

hden commented Mar 20, 2013

@Page- Would you kindly provide a sample code?

Page- commented Mar 20, 2013

Got it down to this test case: http://jsfiddle.net/9dysc/ (run and check the console error log).
What I discovered when making the test case is that it seems to come down to a difference between using eval(js) and Function(js)() - so using CoffeeScript.run instead works correctly (and hence when using coffeescript embedded in script tags).

Contributor

hden commented Mar 20, 2013

@jashkenas Whenever I try to rebuild the browser script it yields a ReferenceError: module is not defined in the coffee-script.js. This happens without any modification of the actual source code. Any hint on how to fix this?

Contributor

hden commented Mar 20, 2013

I think this might fix it: hden/coffee-script@0116600
Can't rebuilding the browser script, so I had to edit the minified script to test this.
Anyway, I probably should not submit a PR until the building problem is fixed.

Owner

jashkenas commented Mar 20, 2013

Building the browser script is working fine for me. Make sure you have uglify-js installed globally with NPM.

... and please send your fix as a pull request. I'll merge it.

Contributor

hden commented Mar 20, 2013

@Page- Would you kindly try this on your project?
CoffeeScript.eval(code, {header: true})

This was referenced Mar 20, 2013

any updates here? I figured out that some lines working fine, other are not working if I set breakpoints in chrome, see substack/coffeeify#7 (comment)

Collaborator

GeoffreyBooth commented May 6, 2017

The fix above has been merged in a while ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment