-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Re-throw module.error when instantiating runtime modules #4918
Re-throw module.error when instantiating runtime modules #4918
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
10 Ignored Deployments
|
✅ This change can build |
} catch (error) { | ||
module.error = error; | ||
throw error; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is purely aesthetic.
throw e; | ||
} finally { | ||
// Always cleanup the intercept, even if module execution failed. | ||
cleanupReactRefreshIntercept(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change isn't related to the issue, but since we don't expect the runtime to completely crash and burn after a module instantiation error occurs, we should still clean up any side-effects.
@@ -1418,6 +1424,9 @@ function instantiateRuntimeModule(moduleId, chunkPath) { | |||
function getOrInstantiateRuntimeModule(moduleId, chunkPath) { | |||
const module = moduleCache[moduleId]; | |||
if (module) { | |||
if (module.error) { | |||
throw module.error; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the actual fix.
🟢 CI successful 🟢Thanks |
…orepo#4918) ### Description Runtime modules can be executed multiple times within the same context. However, when such a module encounters a runtime error during execution, this error is cached in module.error and not properly re-thrown when the module is required again from `getOrInstantiateRuntimeModule`, which means that on later runs we’ll silently fail to instantiate the module, and run into any errors that expects a global side-effect from the module. link WEB-1045
…orepo#4918) ### Description Runtime modules can be executed multiple times within the same context. However, when such a module encounters a runtime error during execution, this error is cached in module.error and not properly re-thrown when the module is required again from `getOrInstantiateRuntimeModule`, which means that on later runs we’ll silently fail to instantiate the module, and run into any errors that expects a global side-effect from the module. link WEB-1045
…orepo#4918) ### Description Runtime modules can be executed multiple times within the same context. However, when such a module encounters a runtime error during execution, this error is cached in module.error and not properly re-thrown when the module is required again from `getOrInstantiateRuntimeModule`, which means that on later runs we’ll silently fail to instantiate the module, and run into any errors that expects a global side-effect from the module. link WEB-1045
Description
Runtime modules can be executed multiple times within the same context. However, when such a module encounters a runtime error during execution, this error is cached in module.error and not properly re-thrown when the module is required again from
getOrInstantiateRuntimeModule
, which means that on later runs we’ll silently fail to instantiate the module, and run into any errors that expects a global side-effect from the module.link WEB-1045