-
-
Notifications
You must be signed in to change notification settings - Fork 257
Description
System Info
rsbuild: v1.0.1-beta.3
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
- React plugin
- less plugin (seems that this plugin has the most impact on the rsdoctor output)
- It has ~ 20 entries
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).
- Additionally, if I only build a single entry (the largest we have), it takes about the same time to produce the output: 12s (with MF) vs 10s.
- The HMR time is also impacted by the number of entries and module federation:
- base (single entries): ~
1.5s - base (all entries): ~
2.5s - with MF (single entry): ~
3.25s - with MF (all entries): ~
25s💥
- base (single entries): ~
If I use @module-federation/enhanced, the build time increases even more (even with dts: 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
export default defineConfig({
plugins: [pluginReact()],
source: {
entry: Object.fromEntries(
Array.from({ length: 200 }, (_, i) => [`index${i}`, "./src/index.tsx"])
)
},
moduleFederation: {
options: {
name: "app",
shared: ["react", "react-dom"]
}
}
});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