Skip to content

perf(layer): only bundle the Nuxt UI locales in use - #1459

Merged
larbish merged 2 commits into
nuxt-content:mainfrom
danielroe:perf/ui-locales
Oct 8, 2026
Merged

larbish merged 2 commits into
nuxt-content:mainfrom
danielroe:perf/ui-locales

Conversation

@danielroe

Copy link
Copy Markdown
Collaborator

app.vue and error.vue import * as nuxtUiLocales from '@nuxt/ui/locale' and pick one at runtime, which can't be tree-shaken, so every Docus site ships all 64 Nuxt UI locales in the entry chunk.

JS preloaded on a docs page main branch
playground (single language), raw 1129 kB 977 kB
playground (single language), brotli 294 kB 266 kB
docus.dev (en + fr), raw 1254 kB 1097 kB
docus.dev (en + fr), brotli 337 kB 308 kB

with i18n, this now bundles only the configured locales (plus en as a fallback). without i18n, the locale comes from app.config.ts, so we can't know it at build time... instead we load it in the i18n plugin, alongside the Docus messages it already loads there.

if nuxt/ui#7152 lands, most of this can go away.

@vercel

vercel Bot commented Oct 7, 2026

Copy link
Copy Markdown

@danielroe is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new

pkg-pr-new Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/create-docus@1459
npm i https://pkg.pr.new/docus@1459

commit: 31338ed

@docus-bundle-report

docus-bundle-report Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Production bundle

Comparing ffe694de with 31338ed7. Compressed sizes are calculated from the emitted production assets.

Metric Base (Brotli) PR (Brotli) Δ Brotli Δ gzip
Client JavaScript 873.8 KiB 846.0 KiB -27.8 KiB (-3.2%) -38.0 KiB (-3.7%)
Client CSS 25.2 KiB 25.2 KiB — —
Other client assets 339.3 KiB 339.3 KiB -1 B (-0.0%) —
Total client assets 1.21 MiB 1.18 MiB -27.8 KiB (-2.2%) -38.0 KiB (-2.6%)

Largest module increases

Module Base (Brotli) PR (Brotli) Δ Brotli
virtual:nuxt:node_modules%2F.cache%2Fnuxt%2F.nuxt%2Fdocus%2Fui-locales.mjs 0 B 121 B +121 B
layer/app/plugins/i18n.ts 916 B 948 B +32 B (+3.5%)
layer/app/app.vue?vue&type=script&setup=true&lang.ts 1.3 KiB 1.3 KiB +18 B (+1.3%)
layer/app/error.vue?vue&type=script&setup=true&lang.ts 889 B 906 B +17 B (+1.9%)
node_modules/@nuxt/ui/dist/runtime/locale/fr.js 1.1 KiB 1.1 KiB +4 B (+0.4%)

Module values come from Nuxt’s analyzer and are attribution estimates. This workflow is currently report-only.

Workflow run

@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docus Ready Ready Preview Oct 8, 2026 9:09am UTC

@larbish larbish left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks 💚

@larbish
larbish merged commit e83a018 into nuxt-content:main Oct 8, 2026
13 checks passed
@danielroe
danielroe deleted the perf/ui-locales branch October 8, 2026 10:12

This branch was successfully deployed

1 active deployment
Preview — 31338ed7 Deployed Oct 8, 2026 by vercel[bot]
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.

2 participants