问题
Is there a way to debug CoffeeScript line-by-line?
I understand that it compiles into Javascript. But this sounds like it could make it a pain to debug.
回答1:
At the moment it is quite a pain to debug CoffeeScript. Most people use lots of unit tests.
There is some work being done on debugging for CoffeeScript but it is probably a while away before we'll have a really good debugger. One example is http://www.infoq.com/news/2011/08/debug-languages-on-javascript-vm
回答2:
Update: there's currently a redesign of coffeescript compiler that generates source maps, which should enable you to debug your coffeescript in most recent versions of Google Chrome (18 and upwards I think).
I think it's not production-ready yet, but it's worth mentioning.
回答3:
if you are running coffeescript from the terminal you can debug it line-for-line using node-inspector, launching your script this way:
coffee --nodejs --debug-brk yourscript.coffee
回答4:
Yes, with node-inspector:
npm install -g node-inspector
By putting the statement debugger into the source code of your script, you will enable a breakpoint. Then type in a console:
coffee -c -m myscript.coffee
node-debug myscript.js
Node Inspector supports source-maps out of the box, so no extra configuration is needed.
For more information see this post.
回答5:
Coffeescript now supports source maps: http://coffeescript.org/
Jetbrains for example supports this feature: https://blog.jetbrains.com/ruby/2013/01/whats-mining-coffeescript-debugger/
来源:https://stackoverflow.com/questions/11068023/debugging-coffeescript-line-by-line