I am writing a NodeJS application. I thought that I would give CoffeeScript a try. I am using gulp to convert my .js files to .coffee files along with the created the source maps. How can I have the console log out the errors pointing to the .coffee files instead of the .js files?
Yes and no.
Compile your frontend code with gulp-coffee and gulp-sourcemaps and Chrome will use these sourcemaps automaticly.
Do not compile your backend code, instead run it with the coffee command.
Doing so all your Stack Traces and Error Lines will be shown corretly.
When writing your server logic in coffee script your should add a start script in your package.json, for example:
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1", // not required but nice to have
"postinstall": "bower i", // not required but nice to have
"start": "coffee server.js"
}
Now you can start your server by calling npm start as you should.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With