Skip to content

per locale splitting via server middleware #425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 3 tasks
samuelstroschein opened this issue Feb 28, 2025 — with Linear · 1 comment · Fixed by opral/monorepo#3474
Closed
1 of 3 tasks

per locale splitting via server middleware #425

samuelstroschein opened this issue Feb 28, 2025 — with Linear · 1 comment · Fixed by opral/monorepo#3474
Assignees
Labels

Comments

Copy link
Member

samuelstroschein commented Feb 28, 2025

Context

The server middleware can be used to achieve per locale splitting on the client.

Taks

  • const result = trackMessageCalls(() => fn)
  • inject message calls in the script to define on a global scope
  • index function retrieves the message from the global scope
@samuelstroschein
Copy link
Member Author

samuelstroschein commented Mar 1, 2025

Per locale splitting works with the middleware. But MPAs don't work (yet).

SSR works fine, but the moment the client takes routing over, no messages exist in the client-side bundle. Leading to the rendering of nothing.

Furthermore, if #354 is implemented, the requirement for per-locale splitting will likely be severely reduced. The majority of SSR's sites would ship 0kb JS as the usage of dynamic messages that have inputs or multiple variants is rare.

Next steps

  • explore filtering the response in the server middleware without effecting client side bundles to not break MPAs, and reduce configuration and complexity

CleanShot.2025-03-01.at.13.09.26.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant