Re:CoffeeScript 1.6.0 released with support for source maps
by aes on Monday March 04, 2013 @10:53PM
(#5322796)
Ok, you'll have to run it through the compiler first with the -m option:
test.coffee:
require 'source-map-support'
throw new Error("Test")
Now do: npm install source-map-support
coffee -c -m test.coffee
node test.js
This gets you the correct line numbers.
Re:CoffeeScript 1.6.0 released with support for source maps
by latchkey on Tuesday March 05, 2013 @01:58AM
(#5323322)
The hard part for me to understand is that I've got way more than just a single file. I've got hundreds of coffee script files for a rather complex nodejs/express app.
I start it up with something like this:
nodemon -w . lib/start/web.coffee
or in production:
coffee lib/start/web.coffee
That web.coffee file then require's a chain of files.If I try to compile the source maps for all of my files first, using something like this:
mkdir .compile
coffee -m --output .compile --compile ./
In the .compile folder, there is a few oddly named subdirectories (d, b, rands, sc) with the compiled .js files in there and the respective .map files. This seems to totally break my require chain.Since I don't normally pre-compile all my coffee script files, I just run them directly using nodemon or coffee, how can I work the maps into my dev process?
Specifically, I tried this test.coffee:
Now running it with still reports the wrong line number in the stack trace.There's supposedly node-source-map-support (https://github.com/evanw/node-source-map-support), but even installing that and adding "require 'source-map-support'" won't help.