Repository navigation
Paraglide: locale modules in the dev server, as with Paraglide 2 - #42
Merged
Merged
Conversation
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
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.
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 setsNODE_ENVbefore it loads the config (productionforvite build,developmentfor the dev server,testunder Vitest).Checked locally
bun run lint✅bun run typecheck✅bun run test✅bun run build✅Generated by Claude Code