@@ -7,7 +7,7 @@ import { addServerPlugin, createResolver, resolvePath, useLogger } from '@nuxt/k
77import yamlPlugin from '@rollup/plugin-yaml'
88import json5Plugin from '@miyaneee/rollup-plugin-json5'
99import { getFeatureFlags } from './bundler'
10- import { isExists } from './utils'
10+ import { getLayerI18n , isExists } from './utils'
1111import {
1212 H3_PKG ,
1313 UTILS_H3_PKG ,
@@ -131,13 +131,16 @@ export { localeDetector }
131131}
132132
133133async function resolveLocaleDetectorPath ( nuxt : Nuxt ) {
134- const serverI18nLayer = nuxt . options . _layers . find (
135- l => l . config . i18n ?. experimental ?. localeDetector != null && l . config . i18n ?. experimental ?. localeDetector !== ''
136- )
134+ const serverI18nLayer = nuxt . options . _layers . find ( l => {
135+ const layerI18n = getLayerI18n ( l )
136+ return layerI18n ?. experimental ?. localeDetector != null && layerI18n ?. experimental ?. localeDetector !== ''
137+ } )
138+
137139 let enableServerIntegration = serverI18nLayer != null
138140
139141 if ( serverI18nLayer != null ) {
140- const pathTo = resolve ( serverI18nLayer . config . rootDir , serverI18nLayer . config . i18n ! . experimental ! . localeDetector ! )
142+ const serverI18nLayerConfig = getLayerI18n ( serverI18nLayer )
143+ const pathTo = resolve ( serverI18nLayer . config . rootDir , serverI18nLayerConfig ! . experimental ! . localeDetector ! )
141144 const localeDetectorPath = await resolvePath ( pathTo , {
142145 cwd : nuxt . options . rootDir ,
143146 extensions : EXECUTABLE_EXTENSIONS
0 commit comments