-
Notifications
You must be signed in to change notification settings - Fork 10
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
Multiple runtime loaded #42
Comments
Thanks @smelukov for your feedback. Are you using the latest alpha version? |
yes |
@zhangHongEn It seems like "Call init first" appears on the first refresh after the build has started |
OK, the dynamic module has a minor flaw when building in vite dev. You need to initiate a request first, that is, refresh the page once and it will be normal. |
If these two @module-federation_runtime.js are on different ports, it is normal |
Yes, these are on different ports, but the mf-runtime should be a singleton, so multiple runtimes break this behaviour. Isn't it? |
If mf-runtime is a single instance, all remote modules' mf-runtime will be forced to use the host. It is possible that the remote uses a higher version of the mf-runtime api (such as runtime api), but the host mf-runtime version is too low. Therefore, mf-runtime is generally multi-instance. |
I get this "Please call init first" error with latest 1.0.0-alpha-4a73cd4 all the time now. Even examples don't work anymore |
@husayt I'm not sure if the new pre-bunding shared solution is not compatible with Windows, because I can't reproduce it. Let me check it out. |
let me know if you need any more details from me. but latest cut breaks both host and remote for me. i have spend whole night trying to make it work |
@husayt Windows issues fixed |
@zhangHongEn it indeed works finally. This is great. Thank you. @gioboa can we get it approved please. Also, while you are on it I raised a PR with updated examples and dependencies @zhangHongEn one key problem (you can see in my examples) there is that seems images are not properly imported. I added an example of SASS with image background. When you run standalone remote it shows dark background, but when run from inside host it doesn't show image |
Closed by #48 |
Just use one https://github.com/module-federation/vite/tree/new-config/examples/vite as a host and one another as a remote. In this case, the module federation runtime chunk is loaded multiple times. Sometimes this leads to a race condition and error with the message "Call init first". If we have 10 vite remotes, then 10 runtime chunks will be loaded.
We need to load and use only one runtime, especially if we use different bundlers (e.g. webpack host, 2 vite remotes, 3 webpack remotes).
@zhangHongEn
The text was updated successfully, but these errors were encountered: