fix(core): restore hreflang links in bundled SSR#2198
Conversation
🦋 Changeset detectedLatest commit: 31ebda6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-verification
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
There was a problem hiding this comment.
This is the right fix for the problem described in #2061. Moving the i18n config from a module-scoped variable to a Symbol.for("emdash:i18n-config") slot on globalThis matches the repository's established singleton pattern (used in request-context.ts, settings/index.ts, and the middleware runtime/setup holders) and directly addresses Vite/Rollup duplicating modules across SSR chunks. The regression test recreates that boundary by using vi.resetModules() and dynamic re-imports, and it would fail under the old module-level _config implementation.
I checked:
- The new
packages/core/src/i18n/config.tssingleton store and all updated consumers (getI18nConfig,isI18nEnabled,resolveConfiguredLocale,getFallbackChain). - Callers of
setI18nConfig/getI18nConfig, including the middleware virtual-config initialization andseo/hreflang.ts. - The new unit test in
packages/core/tests/unit/i18n/config.test.ts. - The changeset (correct package
emdash, user-facing wording).
No blocking issues, convention violations, or new logged-out queries. LGTM.
What does this PR do?
Keeps the configured locale list available when Vite loads EmDash through more than one SSR module chunk. This restores the hreflang links that were skipped when the UI and middleware read separate module instances, and adds a regression test that recreates that boundary.
Closes #2061
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain.AI-generated code disclosure
Screenshots / test output
pnpm buildpnpm typecheckpnpm lintpnpm --filter emdash exec vitest run tests/unit/i18n/config.test.ts(1 test passed)/varvs/private/varpath assertion invirtual-modules.test.ts.