How to disable React error overlay?
See original GitHub issueI find the react-error-overlay
useless because the same info and stack trace is in my console and the error overlay is super slow and blocking browser UI as it loads the stack traces. How do I disable it?
I have tried:
// gatsby-browser.js
import { setConfig } from 'react-hot-loader';
setConfig({ ErrorOverlay: () => null });
window.addEventListener('error', (e) => {
e.stopImmediatePropagation();
e.preventDefault();
});
which was supposed to work? but does nothing.
Any thoughts? Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:5
Top Results From Across the Web
create react app - Disable error overlay in development mode
The error overlay can be disabled by using the stopReportingRuntimeErrors helper utility in the react-error-overlay package ...
Read more >a-kon/disable-react-error-overlay - GitHub
Description. A tiny library to disable annoying the create-react-app's errors' overlay. Do not use it in production mode!
Read more >How to get an error overlay with React Hot Loader - Jakob Lind
How to enable react error overlay for React Hot Loader. First, make sure you are using version 2.2.1 of webpack-dev-server. If you don't,...
Read more >disable-react-error-overlay - npm
Start using disable-react-error-overlay in your project by running `npm i disable-react-error-overlay`. There are no other projects in the ...
Read more >How to use the react-error-overlay/middleware function in ...
To help you get started, we've selected a few react-error-overlay examples, based on popular ways it is used in public projects. ... Secure...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, I have a workable solution now. And it sure makes debugging errors snappier without this overlay. Chrome dev tools was bogging for many seconds parsing the sources lines etc. and totally blocking debugger UI and my OS.
I created a folder in my project
react-error-overlay
and theindex.js
file in there exports all the required functions and does nothing:and pointed the Gatsby webpack alias plugin there:
After clearing the cache and restarting it took this file instead and now doesn’t bog on every error.
I think I found a good CSS only solution to disable the error overlay (the modal) on gatsby. This does not work because on gatsby the html is completely different
I added to my global css:
For my goal it was perfect. I wanted to not display the error overlay when the error was caught by an Error Boundary. With this CSS solution, the overlay will not appear when the Error Boundary catches the error, but when there is no Error Boundary, the screen goes full white, alerting the developer there is an error