node.js - Debug CoffeeScript sources with node-inspector -
i'm using coffeescript while write node.js programs. it's ok debug node-inspector
if compile sources source maps.
however, when try create mixed javascript/coffeescript app using coffee-script/register
:
#!/usr/bin/env node require('coffee-script/register'); require('../src/client');
then, node-inspector shows compiled javascript.
is there how see actual *.coffee
sources in node-inspector
when i'm not explicity compiling it?
disclaimer: maintainer of node inspector
in order see actual *.coffee
file in node inspector, need provide source-map file describing how map transpiled javascript loaded inside node/v8 runtime coffee-script source. additionally, filename of transpiled javascript must different original script name (afaik).
this trouble require('coffee-script/register')
: converts coffee-script source javascript source while keeping same file name. in other words, runtime (and node inspector) see *.coffee
contain transpiled javascript, cannot display coffee script same filename. afaik, coffee compiler not emit source map in case.
i see 2 possible approaches fix problem:
modify
loadfile()
incoffee-script/register
:- emit source map , save file
- pass different filename
module._compile
, e.g.script.coffee.js
modify
coffee-script/register
emit embedded source map. fix chrome devtools and/or node inspector support embedded source maps.
references:
loadfile()
in coffee-script/register- a node inspector issue discussing why
coffee --nodejs --debug app.coffee
not work now: https://github.com/node-inspector/node-inspector/issues/224 - a node inspector issue discussing inline source maps: https://github.com/node-inspector/node-inspector/issues/401
Comments
Post a Comment