Closed btakita closed 9 years ago
i'm working on this as we type :)
the difficulty is that phantomjs doesn't give you real error objects on window.onerror
, so we need to watch it's stdout for errors...which we need to do in addition to getting data via xhr from the headless browser and only need to do for phantomjs. this makes it a tad more ugly but the funcionality is def. needed.
i'll try to come up with a pull request today.
i also tried just using https://github.com/stacktracejs/stacktrace.js on window.onerror
but that didn't do anything
well well well...i tried an approach that requires phantomjs 2.0.0 but this version has been broken on osx yosemite since february. I'm strongly inclined to only adding new features for the browsers this supports, as they are acutally getting updated.
using a capable browser like chrome, you can now do things like:
browserify --debug index.js | browser-run -p 8888
unfortunately source maps can only be seen in chrome's console, not in our terminal. i'll see what i can do to preserve them
cool, using https://www.npmjs.com/package/source-map-support i was able to get this:
∴ browser-run (master) : browserify --debug t.js | bin/bin.js -p 8888
Error: foo
at foo (t.js:2:1)
at Object.1 (t.js:4:1)
at s (../../../../../usr/local/lib/node_modules/browserify/node_modules/browser-pack/_prelude.js:1:1)
at e (../../../../../usr/local/lib/node_modules/browserify/node_modules/browser-pack/_prelude.js:1:1)
at ../../../../../usr/local/lib/node_modules/browserify/node_modules/browser-pack/_prelude.js:1:1
is that good enough for you, @btakita?
To try it out, install 2.6.0
Is there a way to have stack traces that correspond with your source files?
Has anybody successfully used source maps with browser-run?