You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: RuntimeError: factory is undefined during HMR of lazy-loaded React component with a specific dependency. #11922
When updating a React lazy-loaded component, that has a specific (even nested) dependency (eg. md5 or matrix-js-sdk among those I have tested), when this update includes a new import, it always ends up in a RuntimeError: factory is undefined.
Common updates (such as updating a text) do not trigger this.
If the component does not include the "problematic" dependency, or this dependency is within its own lazyload, the issue does not trigger as well.
Removing the top-level lazyload solves this as well.
In our use case, this problem started being very burdensome after working with matrix-js-sdk. The whole view containing usages of the SDK is very hard to develop, every new import ends up in an error & requires full reload. Even after moving the SDK to its separate lazy-load, the issue reappeared when importing enums from this lib.
After some tinkering, I have also found out that the md5 lib has the same issue. And there are definitely many more. You need to find the root cause.
I have tested rsbuild versions 1.4.10, 1.4.15 and 1.5.17 - the error is in all of them.
See the attached reproduction repo - clone & edit TestPage.tsx (see readme).
Activity
stormslowly commentedon Oct 28, 2025
Thank you for reporting this case.
It's similar to #11324 (comment)
You can try this config
But I have missed a case:
isEqual.isEqual.isEuqual.mjs's factory towarnUnexpectedRequireisEqualisEuqual.mjsbefore node modules' hmr chunk applied.warnUnexpectedRequirecalled as a module factory, HMR failed in silence.I will fix it soon.
If different chunk splitting between dev and prod is acceptable, disabling chunk splitting while development is also a workaround option.
vitexikora commentedon Oct 29, 2025
Thanks for looking into this.
I will temporarily disable chuck splitting on dev until it is resolved.