Skip to content

Paraglide: locale modules in the dev server, as with Paraglide 2 - #17

Merged
firsttris merged 1 commit into
mainfrom
fix/paraglide-dev-output-structure
Nov 4, 2026
Merged

firsttris merged 1 commit into
mainfrom
fix/paraglide-dev-output-structure

Conversation

@firsttris

Copy link
Copy Markdown
Owner

Follow-up to the Paraglide JS 3 update: brings back the output structure Paraglide 2 chose by default.

The update set outputStructure: "message-modules" unconditionally, so the generated output still works outside of Vite (v3's new default "virtual-modules" only resolves through Vite). Paraglide 2 used message modules only for production builds and one module per locale otherwise. Without that, the dev server loads every message as its own module: in ccu-addon-mui 1577 Paraglide requests on the first page instead of 5, about twice the load time, and the E2E tests against the dev server timed out (2.5 instead of 1.2 minutes).

Now: process.env.NODE_ENV === "production" ? "message-modules" : "locale-modules", the condition Paraglide 2 used. Vite sets NODE_ENV before it loads the config (production for vite build, development for the dev server, test under Vitest).

Checked locally

  • bun run lint ✅
  • bun run typecheck ✅
  • bun run test ✅
  • bun run build ✅

Generated by Claude Code

Paraglide 2's Vite plugin generated one module per locale outside of
production builds and one per message only for `vite build`. Setting
`outputStructure: "message-modules"` unconditionally made the dev server
load every message as its own module: 1577 Paraglide requests instead of 5
on the first page, about twice the load time, and the E2E tests against
the dev server took 2.5 instead of 1.2 minutes and timed out.

`process.env.NODE_ENV === "production"` is the condition Paraglide 2 used;
Vite sets it before it loads the config (`production` for vite build,
`development` for the dev server, `test` under Vitest).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y3rdfanxjpLranVFzXfytu
@firsttris
firsttris merged commit 69d0a47 into main Nov 4, 2026
6 checks passed
@firsttris
firsttris deleted the fix/paraglide-dev-output-structure branch November 4, 2026 13:48
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