Skip to content

perf(i18n): load the i18n runtime only when the app uses i18n - #361

Merged
harlan-zw merged 1 commit into
mainfrom
perf/lazy-i18n-route-rules
Oct 13, 2026
Merged

harlan-zw merged 1 commit into
mainfrom
perf/lazy-i18n-route-rules

Conversation

@harlan-zw

Copy link
Copy Markdown
Contributor

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

getPathRobotConfig imported the nuxtseo-shared i18n runtime, so every server bundle shipped it, even without @nuxtjs/i18n. A #nuxt-robots/i18n.mjs server template now loads the locale prefix code only when the app has i18n, and an identity function otherwise. Without i18n, the server bundle drops 3,712 bytes (935 gzip) on the Nuxt 4 basic fixture and 3,224 bytes (1,067 gzip) on the Nuxt 5 fixture.

🤖 AI disclosure: Harlan Agent Kit modified this description. My AI open-source policy.

Route rule matching imported the nuxtseo-shared i18n runtime into every server bundle. A server template now resolves it to an identity function when the app has no i18n.
@pkg-pr-new

pkg-pr-new Bot commented Oct 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nuxtjs/robots@361

commit: 204f573

@github-actions

Copy link
Copy Markdown

Nuxt logo Nuxt Module Size Analyzer

Runtime size changed.

Module Client gzip Server raw
@nuxtjs/robots 608 B 164 kB
🟢 -3.8 kB (-2.2%)
Package files (6)

Rows overlap and include unused code. These totals do not measure deployed output or npm downloads.
Excludes dependency files, types, source maps, and other non-code files.

Package files Summed gzip Raw Δ gzip
@nuxtjs/robots · export . 7.2 kB 27 kB 🔴 +73 B (+1.0%)
@nuxtjs/robots · export ./content 292 B 503 B —
@nuxtjs/robots · export ./util 467 B 784 B —
@nuxtjs/robots · built code files 43 kB 140 kB 🔴 +310 B (+0.7%)
@nuxtjs/robots · app source files 3.3 kB 7.2 kB —
@nuxtjs/robots · server source files 9.1 kB 21 kB 🔴 +164 B (+1.8%)
Dependencies (8)

Declared dependencies. Their installed size does not show runtime cost.

Package Dependency Requested
@nuxtjs/robots @fingerprintjs/botd catalog:
@nuxtjs/robots @nuxt/kit catalog:
@nuxtjs/robots @vueuse/core catalog:
@nuxtjs/robots consola catalog:
@nuxtjs/robots defu catalog:
@nuxtjs/robots nuxt-site-config catalog:
@nuxtjs/robots nuxtseo-shared catalog:
@nuxtjs/robots ufo catalog:
How this is measured
  • Compare the same app with and without the module.
  • Client: all emitted JS/CSS, summed per-file gzip. This includes lazy chunks.
  • Server: deployed files, including external dependencies. Source maps are excluded.
  • Default module settings, Node server preset. Memory and request speed are outside this report.

Base: main @ c0d6143 · 2026-10-13 · differences below 16 B are ignored

@harlan-zw

harlan-zw commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Harlan Agent Kit posted this automated status. AI open source policy.

Action required: The pull request has no unreleased merge on the default branch.

@harlan-zw
harlan-zw merged commit 9107510 into main Oct 13, 2026
12 checks passed
@harlan-zw
harlan-zw deleted the perf/lazy-i18n-route-rules branch October 13, 2026 01:33
@harlan-zw harlan-zw mentioned this pull request Oct 13, 2026
6 tasks
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.

1 participant