Open GoogleCodeExporter opened 9 years ago
Since Chrome and Firefox already support sourcemaps natively, we only
really have to worry about node. Which makes things a lot easier.
So this could be a special option for node debug compilation.
#--cut--
npm install --local source-map-support
## Note: Obviously, there is some code here that should have been generated
## automatically.
cat > throw.js <<"END"
require('source-map-support').install();
require('./src/node/traceur.js');
var f = (i) => { throw new Error(`traceur test ${i + 40}`); };
f(2);
END
./traceur --out throw.out.js --sourcemap -- throw.js
## Neat. The error is in the original source file.
node throw.out.js
#--cut--
Thanks for bringing up this library. This is actually pretty cool.
Original comment by usrbi...@yahoo.com
on 27 Mar 2013 at 5:57
Sounds useful
Original comment by arv@chromium.org
on 27 Mar 2013 at 6:04
Oh, didn't know about Chrome and Firefox.
I think src/node/traceur.js should load source-map-support and call install().
It doesn't seem to allow monkey patching of any sort, so you can't have it work
without saving the compiled file and the sourcemap, a proper patch is required
for runtime dynamic sourcemap insertion.
Maybe replace the empty cache with Object.create(exports.overrides), that would
allow traceur to do require('source-map-support').overrides[filename] =
sourceMap;
Original comment by edy.b...@gmail.com
on 27 Mar 2013 at 6:52
Original issue reported on code.google.com by
edy.b...@gmail.com
on 27 Mar 2013 at 2:13