Replies: 1 comment
-
If you have our Chrome DevTool installed, it will handle that. Otherwise, share the JSX runtime Dev as well. Alternatively, you can use a custom runtime plugin and make it prefer the local share of the React Dev version using the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For context, I am using https://rsbuild.dev/ with https://rsbuild.dev/config/module-federation/options and React plugin.
React is checking for
NODE_ENV === 'production'
use the dev or production version.https://github.com/search?q=repo%3Afacebook%2Freact+%22NODE_ENV+%3D%3D%3D+%27production%27%22&type=code
When using module-federation on localhost, this is not an issue as react is usually in dev. mode (both in the MFE and the host application)
However, when using module federation runtime where the host application is using react prod and the MFE is built on local, I have seen issues where React will crash.
For example, you might get:
or
(here is a similar example I found online: https://juejin.cn/post/7185140351303483450)
A workaround locally is to use
but this increases the build time.
Here are two ways to address this, I believe:
react
should allow for a different variable to switch between development and production? (e.g., checking forREACT_PROD === 'true'
orNODE_ENV === 'production'
- see also https://www.youtube.com/watch?v=HMM7GJC5E2o). I am not sure if such a change would be accepted thoughBeta Was this translation helpful? Give feedback.
All reactions