-
-
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
Dynamic shared runtime exposed with Store lost shared data #4271
Comments
I saw module-federation/core@ff5f03e, Will this changes solve my problem? @ScriptedAlchemy |
Do you import the store as an exposed module, but the host also uses it? Is the host's remote entry loaded on the page as well? |
This is likely because the host has its own runtime, and so does the host's remote. So when importing an exposed module or using the "host's own remote" pattern, the exposed module in the remote entry runtime is empty. Since the host is using the module in its runtime graph and not its remotes, there are two instances of the module:
You can try runtimeChunk: single and can look at the single runtime chunk example for webpack-based builds in runtime plug-ins of the examples repository. |
I wonder if the new plugin : '@module-federation/enhanced/webpack' implicitly set runtime false ? |
I set the runtime as false when i detect single runtime chunk. in webpack it should create a partial chunk or on later version now of enhanced, it should bundle the remote into the host runtime, so that by loading th host webpack runtime, it has side effect of setting get,init on the global interface to you never need to load the hosts own remote.js - this is how i do it in next.js |
We have now switched from Webpack to Rsbuild, but I’ve found that the problem still persists: the host and remote are not sharing the runtime. Note that runtimeChunk: 'single' is set in the optimization configuration. |
provide repo |
App1 and App2 are in different git repository
App1 expose app1/getProjectId like :
I call setProjectId('1') in App1, and make app1/getProjectId shared in init functions like
which I expect is in App2 , when I call app1/getProjectId, I can get the value which I set in App1 before, but I got undefined
What should I suppose to do ? Thanks
The text was updated successfully, but these errors were encountered: