parcel icon indicating copy to clipboard operation
parcel copied to clipboard

A setting to disable the React error overlay

Open LoganDark opened this issue 1 year ago • 17 comments

The Parcel error overlay freezes our app for about 10 seconds every time there's an error, which is a constant annoyance and significantly slows down development. It looks like there are no settings to control it whatsoever.

I would like to be able to turn the error overlay off. I don't need the app to be parsing source maps for 10 seconds every time an error occurs - DevTools does that for me.

LoganDark avatar May 24 '24 13:05 LoganDark

This is an enhancement and new feature, which requires discussion with the maintainers: @devongovett @mischnic

hunxjunedo avatar May 24 '24 16:05 hunxjunedo

This is an enhancement and new feature

Perfectly fine by me. I did click the new feature button, but I guess since it doesn't assign any labels that wasn't obvious.

LoganDark avatar May 24 '24 16:05 LoganDark

image

LoganDark avatar May 24 '24 22:05 LoganDark

Damn that looks like a real mess, but still starting to work on this without consulting isn't a good idea.

hunxjunedo avatar May 24 '24 22:05 hunxjunedo

Damn that looks like a real mess, but still starting to work on this without consulting isn't a good idea.

Yeah, don't worry, I'm fine waiting for the maintainers' input. That wasn't intended as a nag, just to show how bad the issue is (it slows testing down by a factor of 2-3x just because I have to sit and wait between every click). A lot of these errors are unrelated to what I'm doing since other people are working on large refactors, so that's why I haven't just fixed them myself.

LoganDark avatar May 24 '24 22:05 LoganDark

it's possible to use the debugger to get the overlay to STFU. set a conditional breakpoint that overwrites require:

image

void (require = ((require) => (module) => (console.log('require(%o)', module), module) === 'e88bec6ec2bff47' ? { setEditorHandler: () => {}, startReportingRuntimeErrors: () => {}, dismissRuntimeErrors: () => {} } : require(module))(require))

if it doesn't fire, replace e88bec6ec2bff47 with whatever is the second log to the console here: image

no more 15-second freezes for everything (even errors caught by error boundaries) !!!!!

LoganDark avatar Jun 09 '24 20:06 LoganDark

@mischnic do you have any thoughts on this? would you accept a PR? we're still impacted by this issue

LoganDark avatar Aug 09 '24 22:08 LoganDark

Bump

kai-dorschner-twinsity avatar Sep 06 '24 09:09 kai-dorschner-twinsity

stfu stale bot

LoganDark avatar Mar 05 '25 12:03 LoganDark

Small update: in the next release we have a refactor to the error overlay to modernize it and improve performance. The expensive source mapping stuff will be done in native code in the dev server instead of in the browser so it should be much faster. https://github.com/parcel-bundler/parcel/pull/10082

Open to adding a flag to disable it entirely as well but hopefully that helps with the underlying reason to do so in the first place.

devongovett avatar Mar 05 '25 23:03 devongovett

that refactor sounds very promising !!

would you be able to toss in a flag just in case? for me it would be nice to know the option exists, even if maybe (hopefully) I won't have to use it

LoganDark avatar Mar 05 '25 23:03 LoganDark

This overlay is actually very disruptive and the user should be allowed to opt-out of that "feature". The last thing you need while debugging is an overlay that blocks the view and that you need to manually close to be able to see what you're working on. Everything is being logged to the console any way and if I want to see errors I can look there.

cdiaz-atlassian avatar Apr 11 '25 06:04 cdiaz-atlassian

@LoganDark I took a more "permanent" temporary approach until this is fixed. I used patch-package to patch @parcel/error-overlay this might also work for you in the meantime.

diff --git a/node_modules/@parcel/error-overlay/lib/index.js b/node_modules/@parcel/error-overlay/lib/index.js
index c7abbdc..26999f8 100644
--- a/node_modules/@parcel/error-overlay/lib/index.js
+++ b/node_modules/@parcel/error-overlay/lib/index.js
@@ -1902,6 +1902,7 @@ function $da9882e673ac146b$export$cda2c88a41631c16(options) {
     $da9882e673ac146b$var$stopListeningToRuntimeErrors = (0, $6d40ebe8356580e0$export$38ec23daa6e8dcdf)($da9882e673ac146b$var$handleRuntimeError(options));
 }
 const $da9882e673ac146b$var$handleRuntimeError = (options)=>(errorRecord)=>{
+    return
         try {
             if (typeof options.onError === 'function') options.onError.call(null);
         } finally{

cdiaz-atlassian avatar Apr 14 '25 03:04 cdiaz-atlassian

As much as I like the overlay for errors, it shouldn't be triggered fro every single react warning.

Extremely disruptive, given no obvious or even clean way to disable it. Almost forced me out of parcel environment, and I wasted quite a while to hack it out.

wojciechb avatar Apr 29 '25 15:04 wojciechb

Did that flag ever make it in?

tehpsalmist avatar Jun 06 '25 20:06 tehpsalmist