11import { directoryToURL , resolveModule } from '@nuxt/kit'
2- import {
3- CORE_BASE_PKG ,
4- CORE_PKG ,
5- MESSAGE_COMPILER_PKG ,
6- NUXT_I18N_MODULE_ID ,
7- SHARED_PKG ,
8- UTILS_H3_PKG ,
9- UTILS_PKG ,
10- VUE_I18N_PKG ,
11- } from './constants'
2+ import { NUXT_I18N_MODULE_ID } from './constants'
123import { defu } from 'defu'
134import { resolveI18nDir } from './layers'
145import { getLayerI18n } from './utils'
@@ -17,14 +8,14 @@ import { relative, resolve } from 'pathe'
178import type { Nuxt } from '@nuxt/schema'
189import type { I18nNuxtContext } from './context'
1910
20- export function setupAlias ( { userOptions : options } : I18nNuxtContext , nuxt : Nuxt ) {
11+ export function setupAlias ( { vueI18nRuntimeOnly } : I18nNuxtContext , nuxt : Nuxt ) {
2112 const modules = {
22- [ VUE_I18N_PKG ] : `${ VUE_I18N_PKG } /dist/vue-i18n${ ! nuxt . options . dev && ! nuxt . options . _prepare && options . bundle ?. runtimeOnly ? '.runtime' : '' } .mjs ` ,
23- [ SHARED_PKG ] : `${ SHARED_PKG } / dist/shared.mjs ` ,
24- [ MESSAGE_COMPILER_PKG ] : `${ MESSAGE_COMPILER_PKG } / dist/message-compiler.mjs ` ,
25- [ CORE_BASE_PKG ] : `${ CORE_BASE_PKG } / dist/core-base.mjs ` ,
26- [ CORE_PKG ] : `${ CORE_PKG } / dist/core.node.mjs ` ,
27- [ UTILS_H3_PKG ] : ` ${ UTILS_PKG } /dist /h3.mjs` , // for `@intlify/utils/h3`
13+ 'vue-i18n' : `vue-i18n /dist/vue-i18n${ vueI18nRuntimeOnly ? '.runtime' : '' } ` ,
14+ '@intlify/shared' : `@intlify/shared/ dist/shared` ,
15+ '@intlify/message-compiler' : `@intlify/message-compiler/ dist/message-compiler` ,
16+ '@intlify/core' : `@intlify/core/ dist/core.node ` ,
17+ '@intlify/core-base' : `@intlify/core-base/ dist/core-base ` ,
18+ '@intlify/utils /h3' : `@intlify/utils/dist/ h3` ,
2819 } as const
2920
3021 const layerI18nDirs = nuxt . options . _layers
@@ -42,10 +33,6 @@ export function setupAlias({ userOptions: options }: I18nNuxtContext, nuxt: Nuxt
4233 } ,
4334 } )
4435
45- // Exclude ESM dependencies from optimization
46- // @see https://github.com/nuxt/nuxt/blob/8db24c6a7fbcff7ab74b3ce1a196daece2f8c701/packages/vite/src/shared/client.ts#L9-L20
47- nuxt . options . vite = defu ( nuxt . options . vite , { optimizeDeps : { exclude : [ UTILS_PKG , ...moduleIds ] } } )
48-
4936 const moduleDirs = ( [ ] as string [ ] )
5037 . concat (
5138 nuxt . options . modulesDir ,
0 commit comments