Skip to content

Commit 92595ed

Browse files
authored
fix: do not fetch from server route if ssr is disabled (#3646)
1 parent 56fd4ba commit 92595ed

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/bundler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export function getDefineConfig({ options, fullStatic }: I18nNuxtContext, server
124124
const common = {
125125
__DEBUG__: String(!!options.debug),
126126
__TEST__: String(!!options.debug),
127+
__IS_SSR__: String(nuxt.options.ssr),
127128
__IS_SSG__: String(nuxt.options._generate),
128129
__PARALLEL_PLUGIN__: String(options.parallelPlugin),
129130
__DYNAMIC_PARAMS_KEY__: JSON.stringify(DYNAMIC_PARAMS_KEY),

src/env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ declare let __DEBUG__: boolean
88
declare let __TEST__: boolean
99

1010
declare let __IS_SSG__: boolean
11+
declare let __IS_SSR__: boolean
1112
declare let __TRAILING_SLASH__: boolean
1213
declare let __PARALLEL_PLUGIN__: boolean
1314
declare let __DIFFERENT_DOMAINS__: boolean

src/runtime/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function createNuxtI18nContext(nuxt: NuxtApp, _i18n: I18n, defaultLocale:
7373
const detectBrowserLanguage = runtimeI18n.detectBrowserLanguage || {}
7474
const localeCookie = createI18nCookie(detectBrowserLanguage)
7575

76-
const dynamicResourcesSSG = !__I18N_FULL_STATIC__ && (import.meta.prerender || __IS_SSG__)
76+
const dynamicResourcesSSG = !__IS_SSR__ || (!__I18N_FULL_STATIC__ && (import.meta.prerender || __IS_SSG__))
7777
/** Get computed config for locale */
7878
const getLocaleConfig = (locale: string) => serverLocaleConfigs.value[locale]
7979
const getDomainFromLocale = createDomainFromLocaleGetter()

0 commit comments

Comments
 (0)