how to debug coffeescript in node.js with webstorm

2019-02-04 14:55发布

I've set up the coffeescript file watcher like in this video

http://www.youtube.com/watch?v=Sl1Uk3zT5Fg

Which seems to work fine for an html project debugging with google chrome. However, when I start debugging and set a breakpoint in the coffeescript file in a node.js project, it doesn't hit the breakpoint. Setting a breakpoint in the generated js file does however get hit.

What do I need to do for the debugger to use the generated source maps and step through the coffeescript with node.js in webstorm 6?

2条回答
2楼-- · 2019-02-04 15:24

According to the issue that CrazyCoder mentioned, it looks like it is an issue with WebStorm expecting the //@ sourceMappingURL=print.map statement at the bottom of a generated JavaScript file rather than at the top which is where the coffeescript compiler currently puts it.

Manaually copying that line to the bottom of the generated script file on every save seems not a viable workaround so I think we'll have to watch that Webstorm issue until it is resolved.

查看更多
聊天终结者
3楼-- · 2019-02-04 15:43

The just released CoffeeScript 1.6.2 now has the annotation for the source map at the bottom as WebStorm expects so it now works as expected.

查看更多
登录 后发表回答