-
Notifications
You must be signed in to change notification settings - Fork 258
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
Require imports do not work if federation is used #454
Comments
Hey, I had the same issue this morning and in my case the issue was caused by the
|
facing the same issue
|
@julianps, thanks, suggested workaround worked for me too, probably will use temporary. But in general it is a ugly workaround, as it couples host and remote and whole module federation purpose is to decouple :) |
@julianps thanks man, works for me too! |
We've noticed that after we've used federation plugin, one part of our application started to fail with:
We saw similar complaints as open issues, but I'm not sure if our issue has the same root cause, hence opening as separate one, if we will see that they converge, we might close one of the issues as duplicate.
It seems, that if remote is importing component that is using require, like this:
it works fine using in vite directly, but fails if used through module federation.
To isolate the issue, I took react-vite example from vite-plugin-federation repo master and adjusted a bit to match our situation, added dependency to failing component:
and added that component to the remote button:
So going directly to remote, everything works as expected, going to host it fails to load due react error.
Any ideas if this can by somehow fixed by adjusting configuration or that is a bug/missing feature in vite-plugin-federation, if yes, would it be hard to fix it?
Currently this is a showstopper for us, even if we possibly could rewrite component used in example to avoid the issue, I think the situation is too common and sooner or later we will face situation were it will not make sense to rewrite and we will be forced to switch back to webpack :(
Versions
The text was updated successfully, but these errors were encountered: