-
-
Notifications
You must be signed in to change notification settings - Fork 170
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
@module-federation/nextjs-mf loads unused remotes #2382
Comments
@2heal1 This problem is caused by the need to pre-load all modules to determine shared. Is there any way for the user to control whether all modules are loaded? |
If the remote is not imported at all it. Bundler should tree shake it as it's not used. If there is any use of the remote though - it needs to be loaded eagerly. |
Hi @ScriptedAlchemy, Is there any way to let the user define which remote should be loaded eagerly? Btw, this problem is not happen on |
Not currently, this is upstream impact caused by federation/enhanced. |
@2heal1 whereever we get the remote data we should replace that logic with how webpack does it. |
I have got the same issue in my project. That might cause the redundant remoteEntry.js files, and my network must have to load those files. My project now is using many different pages. |
Hi @ScriptedAlchemy and @2heal1, is there any update on this? |
seems like preload issue , i will take a look |
I locate the reason , current nextjs mf use 'version-first' as shared strategy by default , and it will load remoteEntry when load shared to sync shared infos . @ScriptedAlchemy How about using 'loaded-first' shared strategy by default ? |
ohhh this is my fault?! Okay ill try disabling this - it is quite an old addition as well |
No, i set 'version-first' as default shared strategy , but i prefer to use 'loaded-first' , can we make it as default strategy ? It can help to prevent extra resource request. |
upgrade |
Thanks @2heal1. I'll check it and get back to you with the result |
@2heal1 @ScriptedAlchemy, I have checked with the latest version of |
Describe the bug
I'm using
@module-federation/nextjs-mf@8.3.10
. The plugin always loads theremoteEntry
of all MFEs even though there is no usage of them.Is there any way to get rid of that behavior? My goal is if there is no usage of a MFE, we should not load it at all.
The issue does not happen with
@module-federation/nextjs-mf@8.2.6
Reproduction
https://github.com/duannx/mf-unused-remotes-issue
Used Package Manager
yarn
System Info
Validations
The text was updated successfully, but these errors were encountered: