NuxtN
Nuxt14mo ago
johnweek

Why i use installModule nuxtjs/i18n in nuxt module cannot working when use 2 more modules

https://github.com/nuxt-modules/i18n/issues/3193

---

Environment Details


  • Operating System: Darwin
  • Node Version: v22.0.0
  • Nuxt Version: 3.13.2
  • CLI Version: 3.15.0
  • Nitro Version: 2.9.7
  • Package Manager: pnpm@9.11.0
  • Modules & Configurations:
    • Runtime Modules:
      @nuxtjs/i18n@8.5.5
    • Build Modules: None specified.
---

Steps to Reproduce


Access the reproduction environment on Stackblitz: Stackblitz Project

Bug Description


While configuring nuxtjs/i18n in module.ts as per the official documentation, I used the following setup:

await installModule('@nuxtjs/i18n', {
  langDir: resolve('./lang'),
  locales: [
    { code: 'en', file: resolve('./lang/en.json') },
    { code: 'fr', file: resolve('./lang/fr.json') },
  ]
});


In
nuxt.config.ts
, when specifying the modules like this:

modules: [
  'module-1', // working 
  '@nuxtjs/i18n'
]


it works as expected. However, when arranging the modules in other combinations, the functionality breaks as shown below:

  • **Configuration 1**:```typescriptmodules: [ 'module-1', // working 'module-2', // not working '@nuxtjs/i18n']```
  • **Configuration 2**:```typescriptmodules: [ 'module-2', // working 'module-1', // not working '@nuxtjs/i18n']```
### Additional Context

I am looking for guidance on achieving the intended configuration or an alternative solution.
GitHub
Environment Details Operating System: Darwin Node Version: v22.0.0 Nuxt Version: 3.13.2 CLI Version: 3.15.0 Nitro Version: 2.9.7 Package Manager: pnpm@9.11.0 Modules & Configurations: Runtime M...
StackBlitzHung Nguyen
Create a new Nuxt project, module, layer or start from a theme with our collection of starters.
Was this page helpful?