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

[v2] Reset stack trace to point the location of error caused JSX if possible #143

Merged
merged 3 commits into from
Apr 16, 2020

Conversation

yhatt
Copy link
Owner

@yhatt yhatt commented Apr 15, 2020

jsx-slack v2 beta has already thrown helpful error message, but the stacktrace is still not useful because it is pointed out the location of internals. It would be difficult to know the cause where is.

Babel JSX transpiler has inject __source sourcemap prop to all JSX elements in development mode, so would be useful for debug JSX. (@babel/plugin-transform-react-jsx-source)

I've updated to reset stacktrace and point out the JSX location if the error of invalid structure was occurred in JSX element having __source prop. It would become easy to find out errored JSX for developer.

In above case, developer can recognize errored JSX at first glance (powered by Jest).

ts-transform-react-jsx-source by Dropbox may also be useful in TypeScript.

@yhatt yhatt mentioned this pull request Apr 15, 2020
8 tasks
@yhatt yhatt merged commit 0b34005 into v2 Apr 16, 2020
@yhatt yhatt deleted the v2-better-stack-trace branch April 16, 2020 01:41
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

Successfully merging this pull request may close these issues.

1 participant