-
Notifications
You must be signed in to change notification settings - Fork 131
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
[Bug]: module federation plugin makes dev/build/HMR a lot slower #3067
Comments
@hverlin You can try to analyze the performance using performance profile. https://www.rspack.dev/guide/optimization/profile |
Thanks, @jerrykingxyz ! I did not notice this also working with the dev-server. Did not think of checking the output directory for the profile. Here are the results: The main difference I see is this very long trace for Not exactly sure what else to check. I see that rsbuild is introducing changes to chunks Some differences I have noticed when running |
Because MF has bugs with Doc: https://rsbuild.dev/config/performance/chunk-split#chunksplitoverride Example: export default {
performance: {
chunkSplit: {
override: {
chunks: 'initial'
},
},
},
}; |
Thanks! Sadly, it appears that just using I think the reason is that
If I manually remove that line from rsbuild, I can see that it then goes back to normal (or omit rsbuild/packages/core/src/plugins/moduleFederation.ts Lines 150 to 152 in f423473
Based on #1461 (comment), it appears that this is actually required for everything to work properly, right? |
Sorry for the delay.
Yes, some cases using I'll transfer this issue to rsbuild |
I will try to fix this in Rsbuild |
@hverlin can you upgrade to the new version and check the performance? https://github.com/web-infra-dev/rsbuild/releases/tag/v1.0.1-beta.9 |
Thank you, @chenjiahan! It's much faster now 👍 |
System Info
Details
Module federation plugin seems to make the build a lot slower. HMR in particular becomes unusable.
I have a large internal rsbuild project where we can clearly see the issue. I am not sure exactly what to share as making a reproducer is quite challenging.
Maybe you have some ideas of what could impact the build time so much.
The project is using
With the built-in module-federation options, the dev output takes 31.6 s instead of `13.5 s.
What I have noticed is that that once I enable the module federation plugin, a lot of time is spent on
sealing chunk optimization
(I don't even have time to read that text when module federation is not enabled).1.5s
2.5s
3.25s
25s
💥If I use
@module-federation/enhanced
, the build time increases even more (even withdts: false
).I tried to reproduce by cloning https://github.com/rspack-contrib/performance-compare/blob/main/rsbuild.config.mjs and updating the configuration as follows
however, it does not seem that the number of entries affects rspack and module federation so much. Also tried adding some less files and used the less-plugin, did not make a difference.
Reproduce Steps
Will share if I manage to make a small example. For now, see the description of the issue.
Is there a large project that I could fork to reproduce the issue? The example projects are small, so it might hard to notice
The text was updated successfully, but these errors were encountered: