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
[Bug]: Rspack Module Federation: TypeError: Cannot read properties of undefined (reading 'setExtraStackFrame') due to jsx-runtime and react mismatch
#9192
Closed
feifeilian opened this issue
Feb 7, 2025
· 2 comments
When using Module Federation with Rspack, I encounter the following error during application startup:
Uncaught TypeError: Cannot read properties of undefined (reading 'setExtraStackFrame')
I think it appears that the issue is caused by an incompatibility between the jsx-runtime and react versions being used. The application seems to be using the local jsx-runtime from node_modules (likely the development version), while react itself is being loaded from a remote, production-built module on a CDN. This mismatch in environments (development vs. production, and potentially versions) is causing the error. This issue is similar to what's described in this React issue: facebook/react#20359
Interestingly, when using Webpack with a similar Module Federation setup, the application runs without errors, even though the same situation occurs (local jsx-runtime, remote react). It's unclear if Webpack has some internal handling that mitigates this issue, or if Rspack is handling Module Federation (specifically shared modules and their dependencies) differently. I've confirmed that Webpack is loading the remote react module, but the local jsx-runtime is somehow working correctly.
I've tried explicitly sharing react/jsx-runtime with singleton: true in both the host and remote configurations, but this did not resolve the issue when the remote module is loaded from the CDN.
Reproduce link
No response
Reproduce Steps
npm run dev
The text was updated successfully, but these errors were encountered:
Hello @feifeilian, sorry we can't investigate the problem further without reproduction demo, please provide a repro demo by forking rspack-repro, or provide a minimal GitHub repository by yourself. Issues labeled by need reproduction will be closed if no activities in 14 days.
Since the issue was labeled with need reproduction, but no response in 14 days. This issue will be closed. Feel free to comment and reopen it if you have any further questions.
System Info
rsapck
Details
When using Module Federation with Rspack, I encounter the following error during application startup:
Uncaught TypeError: Cannot read properties of undefined (reading 'setExtraStackFrame')
I think it appears that the issue is caused by an incompatibility between the jsx-runtime and react versions being used. The application seems to be using the local jsx-runtime from node_modules (likely the development version), while react itself is being loaded from a remote, production-built module on a CDN. This mismatch in environments (development vs. production, and potentially versions) is causing the error. This issue is similar to what's described in this React issue: facebook/react#20359
Interestingly, when using Webpack with a similar Module Federation setup, the application runs without errors, even though the same situation occurs (local jsx-runtime, remote react). It's unclear if Webpack has some internal handling that mitigates this issue, or if Rspack is handling Module Federation (specifically shared modules and their dependencies) differently. I've confirmed that Webpack is loading the remote react module, but the local jsx-runtime is somehow working correctly.
I've tried explicitly sharing react/jsx-runtime with singleton: true in both the host and remote configurations, but this did not resolve the issue when the remote module is loaded from the CDN.
Reproduce link
No response
Reproduce Steps
npm run dev
The text was updated successfully, but these errors were encountered: