Repository navigation
Conversation
…erver Browsers still load one small file per locale. Servers don't download anything, so #importDateFNSLocale now resolves to a version that loads all locales from one bundled file, and server components and SSR compile about 8 translations modules instead of 48. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖 |
AlessioGr
marked this pull request as draft
October 7, 2026 06:18
This was referenced Oct 7, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
importDateFNSLocaleloads one of 40 date-fns locales, each through its ownimport(). That's right for browsers, which only download the language they use. But bundlers compile everyimport()target, so server components and SSR also compiled all 40 locale files and their loaders.Servers don't download anything, so they now load all locales from one bundled file,
dist/dateFNS/all.js. The translations package imports its loader through#importDateFNSLocale, a package-private import defined in theimportsfield ofpackage.json: browsers get the per-locale version, and everything else getsdist/importDateFNSLocale.server.js. The build checks that the server version only reads locales thatall.jsexports.importsworks likeexports, but for paths a package only uses internally. Node, Next.js, Vite and esbuild all support it, andpublishConfigpoints it atdistwhen the package is published, the same way it does forexports. Inside the monorepo, both point at the source file, as before.Results
Fresh website template (Next.js 16.4.0, Turbopack), cold
next devat 4 threads, with locally packed packages:main, andmainplus only this PR. Next.js 16.4 no longer logs compile times, so the/adminresponse time is measured without a browser and covers compiling and rendering the page. Times are medians of 6 interleaved runs, which vary by about ±0.2 s.next dev, 4 threadsmain/admin/admin/admin/admin/adminresponse time, opened first/adminresponse time, after the front-end pageOn its own, the response time change is within run-to-run noise.
🤖 Generated with Claude Code