From b55b7fdc1c2c2a49d98f78a1a29c353363525cc6 Mon Sep 17 00:00:00 2001 From: "Calum H." Date: Sat, 10 Jan 2026 12:43:21 -0500 Subject: [PATCH] feat: enable async context + patch i18n to be more resilient (#5084) * feat: enable async context * feat: improve handling of $i18n defining (patch) --- apps/frontend/nuxt.config.ts | 3 +++ package.json | 3 ++- patches/@nuxtjs__i18n@9.5.6.patch | 15 +++++++++++++++ pnpm-lock.yaml | 7 +++++-- 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 patches/@nuxtjs__i18n@9.5.6.patch diff --git a/apps/frontend/nuxt.config.ts b/apps/frontend/nuxt.config.ts index 7f946b8d..770a1039 100644 --- a/apps/frontend/nuxt.config.ts +++ b/apps/frontend/nuxt.config.ts @@ -300,6 +300,9 @@ export default defineNuxtConfig({ }, compatibilityDate: '2025-01-01', telemetry: false, + experimental: { + asyncContext: true, + }, }) function getApiUrl() { diff --git a/package.json b/package.json index 1c19c0eb..14e29f6e 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,8 @@ "packageManager": "pnpm@9.15.0", "pnpm": { "patchedDependencies": { - "readable-stream@2.3.8": "patches/readable-stream@2.3.8.patch" + "readable-stream@2.3.8": "patches/readable-stream@2.3.8.patch", + "@nuxtjs/i18n@9.5.6": "patches/@nuxtjs__i18n@9.5.6.patch" }, "peerDependencyRules": { "allowedVersions": { diff --git a/patches/@nuxtjs__i18n@9.5.6.patch b/patches/@nuxtjs__i18n@9.5.6.patch new file mode 100644 index 00000000..e77dd633 --- /dev/null +++ b/patches/@nuxtjs__i18n@9.5.6.patch @@ -0,0 +1,15 @@ +diff --git a/dist/runtime/plugins/i18n.js b/dist/runtime/plugins/i18n.js +index 7a71fcfda18c0770be2c4b7a0b3c2b875bbb832e..cd008b4126400a909bcc66897a1344cb5659e8a6 100644 +--- a/dist/runtime/plugins/i18n.js ++++ b/dist/runtime/plugins/i18n.js +@@ -157,7 +157,9 @@ export default defineNuxtPlugin({ + } + }); + nuxt.vueApp.use(i18n); +- Object.defineProperty(nuxt, "$i18n", { get: () => getI18nTarget(i18n) }); ++ if (!Object.prototype.hasOwnProperty.call(nuxt, '$i18n')) { ++ Object.defineProperty(nuxt, "$i18n", { get: () => getI18nTarget(i18n), configurable: true }); ++ } + return { + provide: { + /** diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fbdd1021..2da1f154 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,6 +5,9 @@ settings: excludeLinksFromLockfile: false patchedDependencies: + '@nuxtjs/i18n@9.5.6': + hash: vp2g27ju44j765ltfjh4og6y5a + path: patches/@nuxtjs__i18n@9.5.6.patch readable-stream@2.3.8: hash: h52dazg37p4h3yox67pw36akse path: patches/readable-stream@2.3.8.patch @@ -365,7 +368,7 @@ importers: version: link:../../packages/tooling-config '@nuxtjs/i18n': specifier: ^9.0.0 - version: 9.5.6(@vue/compiler-dom@3.5.26)(eslint@9.39.2(jiti@2.6.1))(magicast@0.5.1)(rollup@4.54.0)(vue@3.5.26(typescript@5.9.3)) + version: 9.5.6(patch_hash=vp2g27ju44j765ltfjh4og6y5a)(@vue/compiler-dom@3.5.26)(eslint@9.39.2(jiti@2.6.1))(magicast@0.5.1)(rollup@4.54.0)(vue@3.5.26(typescript@5.9.3)) '@types/dompurify': specifier: ^3.0.5 version: 3.2.0 @@ -11132,7 +11135,7 @@ snapshots: - vue-tsc - yaml - '@nuxtjs/i18n@9.5.6(@vue/compiler-dom@3.5.26)(eslint@9.39.2(jiti@2.6.1))(magicast@0.5.1)(rollup@4.54.0)(vue@3.5.26(typescript@5.9.3))': + '@nuxtjs/i18n@9.5.6(patch_hash=vp2g27ju44j765ltfjh4og6y5a)(@vue/compiler-dom@3.5.26)(eslint@9.39.2(jiti@2.6.1))(magicast@0.5.1)(rollup@4.54.0)(vue@3.5.26(typescript@5.9.3))': dependencies: '@intlify/h3': 0.6.1 '@intlify/shared': 10.0.8