-
Notifications
You must be signed in to change notification settings - Fork 87
fix: use already-initialized runtime instance to avoid mixing ESM and CJS imports #363
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
base: main
Are you sure you want to change the base?
Conversation
gioboa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's awesome.
Thanks for your help @sabov
Did you test it locally?
|
I get the same error when I try run Looks like this fixes breaks something. I'll try to find a workaround. |
|
|
|
Looks like the |
gioboa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your commitment. We should definitely try with the latest module federation runtime.
Ignore this, I forgot to use
I can update the package and give it a try. |
|
@sabov yeah :) it works in One thing in
but this comes from
Not sure if it is related to this bug. I'll try to test a bit more to be sure that this issue isn't related to vite version or this this changes (cache or something else) |
|
Thanks for confirming, @wojtask9! Re: breaking change or not After a couple of tests I see that with and without the fix in some cases a page still must be loaded twice (I can't reproduce it in the examples).
I believe this is another issue related to |




Issue: #362
Multiple instances of
@module-federation/runtimeare used because:The fix is to get loadShare/loadRemote methods directly from the runtime instance that was passed through initPromise.
An alternative solution could be turning
@module-federation/runtimeinto a singleton but there are multiple edge cases to take care of like: it could be pre-bundled in one of the remotes, multiple versions could be imported, etc.