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

Show javascript errors in overlay #582

Closed
KyleAMathews opened this issue Nov 29, 2016 · 12 comments
Closed

Show javascript errors in overlay #582

KyleAMathews opened this issue Nov 29, 2016 · 12 comments
Labels
help wanted Issue with a clear description that the community can help with.

Comments

@KyleAMathews
Copy link
Contributor

create-react-app and next.js have this and it's super cool and useful. You know right away when something is wrong instead of having to keep glancing at your terminal or browser console.

Also next.js adds syntax highlighting to the error which is nifty.

vercel/next.js#195

@KyleAMathews KyleAMathews added DX help wanted Issue with a clear description that the community can help with. labels Nov 29, 2016
@KyleAMathews
Copy link
Contributor Author

@vinnymac
Copy link
Contributor

vinnymac commented Nov 29, 2016

For those who aren't familiar, redbox-react is usually used to do this. Looks like the create-react-app folks are trying to push the feature into the future though.

@jthegedus
Copy link

jthegedus commented Feb 6, 2017

Re: create-react-app the webpack-dev-server@2.3.0 webpack/webpack-dev-server@d725fd9 added some support for the CRA implementation of overlays. Discussed by the CRA team here

@KyleAMathews
Copy link
Contributor Author

PR adding this to another project react-cosmos/react-cosmos#484

@Timer
Copy link
Contributor

Timer commented Oct 30, 2017

If anyone takes this on don't hesitate to ask me questions, I could also give it a stab if someone points me in the right direction (where it'd need wired into).

@KyleAMathews
Copy link
Contributor Author

Oh sweet! Thanks for hopping in and offering to help! Would love to get this in soon. First question though is does the overlay work with webpack 1 still? That's where we are still unfortunately.

This is the entry file for development https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/cache-dir/root.js

@Timer
Copy link
Contributor

Timer commented Oct 30, 2017

Depends on what angle you're asking that question -- our webpack middleware might work with webpack 1, but we know it works on webpack 3.

As for the overlay itself (just importing): currently, no -- we only ship an ESM version of the overlay (you could put it through babel).
The next version (should) include a CJS version which can be consumed by webpack 1 easily.

The overlay itself does not depend on anything webpack, its a completely separate package with 0 dependencies -- we just have to decide on the integration points.

@KyleAMathews
Copy link
Contributor Author

What does the integration point need to be? Where in the app is it?

@Timer
Copy link
Contributor

Timer commented Nov 2, 2017

The overlay simply needs to be required in the applications source, preferably as an entry point.

The "integration" points I was speaking of pertain to the click-to-open source / build errors; you can use our webpack development server or add the necessary hooks to enable those features in your server (none of which are necessary for the overlay to work).

@KyleAMathews
Copy link
Contributor Author

Oh sweet — sounds fairly straightforward then.

Would love a PR adding the overlay to https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/cache-dir/root.js

We use webpack-dev-middleware — is the click-to-open / build errors compatible with that?

require(`webpack-dev-middleware`)(compiler, {
Happy to take suggestions for alternative setups if they're more compatible.

@Timer
Copy link
Contributor

Timer commented Nov 4, 2017

#2783

@KyleAMathews
Copy link
Contributor Author

This is shipped! Thanks again @Timer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issue with a clear description that the community can help with.
Projects
None yet
Development

No branches or pull requests

5 participants