Skip to content

Conversation

@avivkeller
Copy link
Member

Currently, per Next.js's bundle analyzer, all locales are sent to the client.

This PR removes the importLocale function, as I suspect it was the culprit.

@vercel
Copy link

vercel bot commented Dec 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nodejs-org Ready Ready Preview Dec 24, 2025 9:37pm

@github-actions
Copy link
Contributor

👋 Codeowner Review Request

The following codeowners have been identified for the changed files:

Team reviewers: @nodejs/nodejs-website @nodejs/web-infra

Please review the changes when you have a chance. Thank you! 🙏

@codecov
Copy link

codecov bot commented Dec 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.73%. Comparing base (26885a8) to head (01712e1).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8447      +/-   ##
==========================================
+ Coverage   73.65%   73.73%   +0.08%     
==========================================
  Files         108      108              
  Lines        9193     9200       +7     
  Branches      312      312              
==========================================
+ Hits         6771     6784      +13     
+ Misses       2420     2414       -6     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 24, 2025

📦 Build Size Comparison

Summary

Metric Value
Old Total Size 3.87 MB
New Total Size 3.72 MB
Delta -157.60 KB (-3.98%)

Changes

➕ Added Assets (10)
Name Size
.next/static/chunks/fa932e36207d3c37.js 7.39 KB
.next/static/chunks/a3cfaae73cc9829a.js 205.09 KB
.next/static/chunks/1bcb423cc68e4519.js 420.23 KB
.next/static/chunks/0ca5a898d74e1320.js 101.75 KB
.next/static/chunks/cfe08bb0319e2089.js 101.75 KB
.next/static/chunks/cdc0187de4bc1dc9.js 420.23 KB
.next/static/chunks/c619259ab105a24f.js 29.33 KB
.next/static/chunks/4e8127ac24711e68.js 420.23 KB
.next/static/chunks/6b300a14476c7ff2.js 101.75 KB
.next/static/chunks/7bec94e88ee60b41.js 101.75 KB
➖ Removed Assets (24)
Name Size
.next/static/chunks/b4efa9ff898bc368.js 8.73 KB
.next/static/chunks/9385d8b2e7a095eb.js 205.09 KB
.next/static/chunks/c6c8e12dae9ee1d3.js 420.22 KB
.next/static/chunks/45b88b380febe3f1.js 101.82 KB
.next/static/chunks/92e67856daf1a4b9.js 11.83 KB
.next/static/chunks/b9ae97a0192791f5.js 10.25 KB
.next/static/chunks/cc99386c874dd757.js 13.62 KB
.next/static/chunks/25a52a6363a0e34a.js 12.41 KB
.next/static/chunks/acc9e14a9f3e8850.js 14.62 KB
.next/static/chunks/4ef2011e5fc83625.js 7.66 KB
.next/static/chunks/b716f9980d69253a.js 12.85 KB
.next/static/chunks/4a38115ad626c02a.js 8.21 KB
.next/static/chunks/5e0f3f698316d2ed.js 12.77 KB
.next/static/chunks/3600fbabe8ad9c69.js 10.02 KB
.next/static/chunks/cbea7dbb4c7a09e2.js 16.60 KB
.next/static/chunks/b83473ea70615a51.js 7.17 KB
.next/static/chunks/686e8d34ebdd5911.js 7.94 KB
.next/static/chunks/83213084dbfcde8d.js 8.73 KB
.next/static/chunks/7d19e315e828bf5f.js 101.82 KB
.next/static/chunks/1e20ac2182ce696d.js 420.22 KB
.next/static/chunks/a017a80ed43c7efc.js 101.82 KB
.next/static/chunks/8a7495cc1dadd74d.js 30.67 KB
.next/static/chunks/b06e6b58ff5ac09b.js 420.22 KB
.next/static/chunks/84b4b6c5f0c7e49f.js 101.82 KB

@avivkeller avivkeller marked this pull request as ready for review December 24, 2025 21:07
@avivkeller avivkeller requested a review from a team as a code owner December 24, 2025 21:07
Copilot AI review requested due to automatic review settings December 24, 2025 21:07
@avivkeller avivkeller requested a review from a team as a code owner December 24, 2025 21:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the i18n package to prevent locale translations from being bundled to the client. The main change removes the importLocale function and converts exported functions (getters) into direct constant exports, while updating all consuming code to import directly from the i18n package instead of through the wrapper file.

Key changes:

  • Removed importLocale function and converted getter functions to constant exports in the i18n package
  • Deleted the apps/site/next.locales.mjs wrapper file
  • Updated all import statements across the codebase to import directly from @node-core/website-i18n

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/i18n/src/index.mjs Removed importLocale function and converted getter functions to constant exports
docs/technologies.md Removed documentation section for the deleted next.locales.mjs file
apps/site/tests/e2e/general-behavior.spec.ts Replaced importLocale with direct dynamic import and static import for English locale
apps/site/next.rewrites.mjs Updated import to use @node-core/website-i18n directly
apps/site/next.locales.mjs Deleted wrapper file that re-exported i18n functions
apps/site/next.dynamic.page.mjs Updated imports to source from @node-core/website-i18n
apps/site/next.dynamic.mjs Updated imports to source from @node-core/website-i18n
apps/site/next-data/generators/downloadSnippets.mjs Updated import to use @node-core/website-i18n directly
apps/site/navigation.mjs Updated import to use @node-core/website-i18n directly
apps/site/middleware.ts Updated imports to source from @node-core/website-i18n
apps/site/i18n.tsx Replaced importLocale with direct dynamic import and updated other imports
apps/site/components/withNavBar.tsx Updated import to use @node-core/website-i18n directly
apps/site/components/withMetaBar.tsx Updated import to use @node-core/website-i18n directly
apps/site/components/withDownloadSection.tsx Updated import to use @node-core/website-i18n directly
apps/site/app/sitemap.ts Updated imports to source from @node-core/website-i18n
apps/site/app/[locale]/page.tsx Updated imports to source from @node-core/website-i18n
apps/site/app/[locale]/next-data/og/[category]/[title]/route.tsx Updated import to use @node-core/website-i18n directly
apps/site/app/[locale]/layout.tsx Updated imports and replaced availableLocalesMap with inline find() operation
apps/site/app/[locale]/feed/[feed]/route.ts Updated import to use @node-core/website-i18n directly
apps/site/app/[locale]/download/archive/[version]/page.tsx Updated import to use @node-core/website-i18n directly
apps/site/app/[locale]/blog/[...path]/page.tsx Updated import to use @node-core/website-i18n directly
apps/site/app/[locale]/[...path]/page.tsx Updated imports to source from @node-core/website-i18n

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think OP understands the side effects of their changes.

Please read next-intl docs and triple check you're not breaking things unintentionally...

Edit: the phrasing above was poor, I meant to say that Im not confident of the changes and that OP has checked if every next-intl feature is still working as expected. I absolutely believe on OP's skill and just wanted to ensure that they verify that everything is still working as expected

@avivkeller avivkeller marked this pull request as draft December 24, 2025 21:22
Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM! Appreciate for triple checking on my concerns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants