-
-
Notifications
You must be signed in to change notification settings - Fork 516
Open
Labels
Description
Environment
- Operating System:
Darwin - Node Version:
v25.0.0 - Nuxt Version:
4.2.1 - CLI Version:
3.30.0 - Nitro Version:
2.12.9 - Package Manager:
[email protected] - Builder:
- - User Config:
app,devServer,compatibilityDate,devtools,css,vite,i18n,ssr,shadcn,colorMode,content,modules,nitro - Runtime Modules:
@nuxt/[email protected],@nuxt/[email protected],@nuxt/[email protected],@nuxt/[email protected],@nuxt/[email protected],@nuxt/[email protected],@nuxtjs/[email protected],[email protected],@pinia/[email protected] - Build Modules:
-
Reproduction
NirvanaCh7/nuxt-i18n-issue-20251203
It’s easy to describe, you don’t need it.
Describe the bug
i18n/locales/en/index.js
import common from './common.js'
export default {
...common,
}i18n/locales/en/common.js
export default { welcome: 'Welcome',}.nuxt/dev/index.mjs
import common from '../../../../../../../../../i18n/locales/en/common.js';
// 9 "../"result:
Cannot find module '/i18n/locales/en/common.js' imported from index.mjs
I could access it using an ~~ alias, that’s not a problem. I’m trying to figure out why this happens. Maybe it’s an issue of Nuxt?
Additional context
New issue
i18n/locales/en/index.js
import common from '~~/i18n/locales/en/common.js'
export default {
...common,
}i18n/locales/en/common.js
// fails× import another from '~~/i18n/locales/en/another.js'
//Cannot find package '~~' imported from
import another from './another.js' // works√
export default {
welcome: 'Welcome',
...another
}Maybe I am using it incorrectly.
And I found that this part ,after the first-level import, is pre-compiled, and refreshing the browser does not apply changes. It seems the file is not included in Nuxt’s HMR watch list.