You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Library chunks make lazy routes' dependencies load at startup #4966
libChunksGroup() puts each node_modules package into its own chunk. Rolldown's includeDependenciesRecursively defaults to true, so that chunk also includes everything the package imports. When startup code imports one small module from a package, the server loads the whole chunk. That can include code that only lazy routes use.
In my Nuxt app, a shared file imports mrmime to look up MIME types. mrmime ended up in the same chunk as Realtime, so Tiptap, ProseMirror and yjs all loaded at startup.
Setting entriesAware: true on the group fixes it. Rolldown then splits each package chunk by the entries that use it. On the app's Node build, startup modules went from 9.4 MB to 6.4 MB. The first request loaded 6.0 MB of extra modules instead of 11.8 MB. Responses didn't change.
Rolldown names the split chunks <group>~<entries>~<hash>. To keep file names the same as today, getChunkName() drops everything from the first ~.
I have a patch with tests, and Nitro's unit tests, typecheck and lint pass. Would you accept this as the default, or would you rather have it behind an option? I can open the PR.
Additional information
Would you be willing to help implement this feature?
Activity