Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Babel-loader looses correct error stack when Promise and react-router is used #114

Closed
gryzzly opened this issue Oct 6, 2015 · 7 comments

Comments

@gryzzly
Copy link

gryzzly commented Oct 6, 2015

When initial rendering kicks off in a Promise callback the error stack and location are lost. The stack and location are correct when using transform-loader?babelify with exact same code.

Here's babel-loader:
screen shot 2015-10-06 at 14 42 33

Here babelify via webpack’s transform-loader yields correct code location:
screen shot 2015-10-06 at 14 38 52

I've tried to compile the minimal code to reproduce, removing routing from the code solves the problem, but with babelify it works without removing routing: https://github.com/gryzzly/babel-loader-issue

@zloirock
Copy link
Member

zloirock commented Oct 6, 2015

zloirock/core-js#107. Unhandled rejection tracking is not a part of spec. Stack - also. If you wanna help implement long stack trace - welcome.

@gryzzly
Copy link
Author

gryzzly commented Oct 6, 2015

@zloirock thanks for the reply! this doesn't only happen with core-js Promise, I tried bluebird as well, stack is lost only with babel-loader and again is not lost with transform?babelify

@zloirock
Copy link
Member

zloirock commented Oct 6, 2015

You tried bluebird with Promise.longStackTraces()?

@gryzzly
Copy link
Author

gryzzly commented Oct 6, 2015

@zloirock I tried previously with less "reduced" setup (more of my app code was in the example).

Retried again and now I can see that actually bluebird will provide stack trace with longStackTraces() with both babel-loader and transform?babelify, but it will point at compiled bundle rather than original code via source map. In entry point file at the top:

import Promise from 'bluebird';
Promise.longStackTraces();
require('babel-runtime/core-js/promise').default = Promise;

I put that above other requires and I could definitely see that bluebird was picked up. The trace it prints is different as it’s using console.warn. So with bluebird I get this with both loaders:
screen shot 2015-10-06 at 23 51 04

@gryzzly
Copy link
Author

gryzzly commented Oct 6, 2015

I found that in my case just using window.Promise solves the issue as I need this to work only in Chrome. That proves the issue lies in es6.promise.js indeed as you suggested and so can be closed. Thanks for looking into it!

@benjamingr
Copy link

zloirock/core-js#107. Unhandled rejection tracking is not a part of spec. Stack - also. If you wanna help implement long stack trace - welcome.

Actually, it's a part of the spec - tc39/ecma262#76

@zloirock
Copy link
Member

zloirock commented Oct 8, 2015

@benjamingr I mean ES6 :) Anyway, unhandled rejection tracking available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants