feat: enable async context + patch i18n to be more resilient (#5084)

* feat: enable async context

* feat: improve handling of $i18n defining (patch)
This commit is contained in:
Calum H.
2026-01-10 12:43:21 -05:00
committed by GitHub
parent 0b60060f65
commit b55b7fdc1c
4 changed files with 25 additions and 3 deletions

View File

@@ -300,6 +300,9 @@ export default defineNuxtConfig({
},
compatibilityDate: '2025-01-01',
telemetry: false,
experimental: {
asyncContext: true,
},
})
function getApiUrl() {

View File

@@ -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": {

View File

@@ -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: {
/**

7
pnpm-lock.yaml generated
View File

@@ -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