Question

In node.js express app and nodeunit tests I widely use coffeescript without saving resulting javascript files on disk to avoid project clogging by javascript translations.

When I got any error in coffeeScript file I see in console: the filename where error was occured and line number (for example 37): /pathTo_File/fileName.coffee:37. But I dont have 37th line in my coffee file!!! I have two times less lines there.

I guess that I got error on 37th row in my output javascript file, but I don't have it on disk. Coffeescript files only.

So how I can get line number with error in coffeescript file?

I understand that I can translate my coffee script file manually (using console) to js and see there line number and guess on what line I got that error on my coffee file. But maybe there is something faster.

My IDE is WebStorm and os is osX.

Était-ce utile?

La solution

CoffeeScript 1.6.1 and above include support for generating source maps, a way to tell your JavaScript engine what part of your CoffeeScript program matches up with the code being evaluated. Browsers that support it can automatically use source maps to show your original source code in the debugger. To generate source maps alongside your JavaScript files, pass the --map or -m flag to the compiler.

http://coffeescript.org/#source-maps

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top