Skip to content
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

[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
Assignees

Comments

@feifeilian
Copy link

System Info

rsapck

Details

When using Module Federation with Rspack, I encounter the following error during application startup:

Image

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

Image

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

@feifeilian feifeilian added the pending triage The issue/PR is currently untouched. label Feb 7, 2025
@chenjiahan chenjiahan added need reproduction and removed pending triage The issue/PR is currently untouched. labels Feb 10, 2025
Copy link
Contributor

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.

Copy link
Contributor

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.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants