-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
instructions for adding react-error-overlay? #2890
Comments
There's some info / discussion on this here: #1088 |
after looking at how create-react-app now does things i am not confident that |
Note that you can't modify entry point in custom webpack config. You may want to add something like this at the top of your if (process.env.NODE_ENV !== 'production') {
require('react-error-overlay');
} |
As for middleware, we have a non-documented (unfortunately) feature of adding it using
|
well whaddaya know!!!!
import { configure } from '@storybook/react';
if (process.env.NODE_ENV !== 'production') {
require('react-error-overlay');
require('react-dev-utils/webpackHotDevClient')
}
// automatically import all files ending in *.stories.js
const req = require.context('../stories', true, /.stories.js$/);
function loadStories() {
req.keys().forEach((filename) => req(filename));
}
configure(loadStories, module);
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
module.exports = router => router.use(errorOverlayMiddleware()) |
thanks so much for your help guys! you're amazing. same day issue solving. wow. |
@tsiq-swyx any idea how I could use this with an iFrame inside a react app? I am making an app similar to codesandbox and I would like to show this when there is a runtime error or bundling error. |
Issue details
Hi friends! i would like to add react-error-overlay to my storybook webpack.config.js but i dont know how... any help would be appreciated!
Steps to reproduce
what i have so far:
in
.storybook/webpack.config.js
:and in
.storybook/middleware.js
:and storybook runs fine but it doesnt catch the error and render the ErrorOverlay iframe.
Please specify which version of Storybook and optionally any affected addons that you're running
please let me know your ideas and i would be happy to try them out!
The text was updated successfully, but these errors were encountered: