Reputation: 717
I want to use react-error-overlay package from create-react-app outside the create-react-app.
But it doesn't provide any document about how to apply it.
Does anyone know how to make that happened?
Thanks
Upvotes: 3
Views: 3206
Reputation: 2511
hello just leaving a tip - if you want to just use the runtime overlay, do this: https://twitter.com/swyx/status/961413452446257152
you can also synchronously call the buildtime overlay but that is more involved and is best done using the errorOverlayMiddleware (which FYI has moved to react-dev-utils)
good luck
Upvotes: 0
Reputation: 997
Option B - Roll back your react-error-overlay
to a 1.x compatible version inside your package.json
Upvotes: 0
Reputation: 39
Add a require.resolve to your app entry point array
app: [
require.resolve('react-error-overlay'),
'./src/app/'
],
Add the setup function to your webpack-dev-server configuration so you can add the middleware
setup(app) {
app.use(errorOverlayMiddleware());
}
All done
Upvotes: 3