14

Now that CoffeeScript supports the new Source Map hotness, I was wondering if I can also use the source maps not just in my browser, but on the command line while developing my nodeJS apps.

I want the JS compiler to give me more useful error traces where the lines actually match with my coffeescript files instead of compiled JS files.

3 Answers 3

18

The source-map-support module does this, just install the module and put this at the top of your code:

require('source-map-support').install()
Sign up to request clarification or add additional context in comments.

2 Comments

this doesnt appear to work with coffee-script 1.6.3 and node v0.10.23. coffee-script-mapped works great though. Perhaps its because I'm running my code without compiling it first? IE, I do require('coffee-script'); require('source-map-support').install(); and then all required files are coffee files.
@rbrc This pull request of mine might address your issue with source-map-support.
5

Now with CoffeeScript 1.6.2 it just "works" if you run your app with the coffee command :)

2 Comments

This doesn't seem to work for .coffee files that are included with require - I'm seeing stuff like main.coffee:12:1, <js>:20 but then imported.coffee:185:3 and the imported.coffee only has 130 lines of coffeescript.
Being exasperated with the current solutions, I've made this: npmjs.org/package/coffee-script-mapped Let me know if it works for you :)
3

Until coffee-script gets some better support for require(), try this: https://npmjs.org/package/coffee-script-mapped

2 Comments

if you're running node, how would you go about using this?
this answer is a bit out of date now, from my recollection coffee-script it self supports require already.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.