Skip to content

Documentation for module integration describes deprecated installModule #3912

@vaidd4

Description

@vaidd4

Environment

  • nuxt@3.20.2
  • @nuxt/kit@3.20.2
  • @nuxtjs/i18n@10.2.1

Reproduction

Nuxt I18n documentation "Installing from a module" page : https://i18n.nuxtjs.org/docs/guide/install-module

(file docs/content/docs/02.guide/17.install-module.md)

Describe the bug

Hello, while adding i18n in a module as per the docs, my IDE warned me of the deprecation.

In the exemple shown in the "Installing from a module" page,
The function installModule() from @nuxt/kit shows a deprecated notice: Deprecated: Use module dependencies.
Also there is a warning in the Nuxt documentation:
https://nuxt.com/docs/4.x/api/kit/modules#installmodule

The "correct/modern" way is to use module dependencies as shown in Nuxt Documentation:
https://nuxt.com/docs/4.x/api/kit/modules#specifying-module-dependencies

Additional context

I donk have a reproduction but I successfully used this module dependencies config in a Nuxt v3 project.
The equivalent of the exemple code block from the docs is:

export default defineNuxtModule({
  moduleDependencies: {
    '@nuxtjs/i18n': {
      defaults: {
        vueI18n: resolve(dirname(fileURLToPath(import.meta.url)), './i18n.config.ts'),
        langDir: resolve(dirname(fileURLToPath(import.meta.url)), './lang'),
        locales: [
          {
            code: 'en',
            file: resolve(dirname(fileURLToPath(import.meta.url)), './lang/en.json'),
          },
        ],
      },
    },
  },
  setup() {
    // ...
  }
})

Or, it can also be defined as a function to use createResolver like in the current docs :

export default defineNuxtModule({
  moduleDependencies (nuxt) {
    const { resolve } = createResolver(import.meta.url)
    return {
      '@nuxtjs/i18n': {
        defaults: {
          vueI18n: resolve('./i18n.config.ts'),
          langDir: resolve('./lang'),
          locales: [
            {
              code: 'en',
              file: resolve('./lang/en.json'),
            },
          ],
        },
      },
    }
  },
  setup() {
    // ...
  }
})

Both worked perfectly for me as-is with just a different folder.

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    need documentationNot necessarily a bug, but proper documentation is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions