i18n: App build failed: Cannot find module '.output/public/__i18n__/prerender/3c199285.js'

Environment

------------------------------
- Operating System: Darwin
- Node Version:     v18.16.0
- Nuxt Version:     3.4.3
- Nitro Version:    2.4.0
- Package Manager:  pnpm@8.5.1
- Builder:          vite
- User Config:      modules, i18n
- Runtime Modules:  @nuxtjs/i18n@8.0.0-beta.12
- Build Modules:    -
------------------------------

Reproduction

Stackblitz: https://stackblitz.com/github/lukaszflorczak/nuxt-i18n-playground/tree/issue/vue-i18n-config Repository: https://github.com/lukaszflorczak/nuxt-i18n-playground/tree/issue/vue-i18n-config

  1. pnpm install
  2. pnpm build
  3. node .output/server/index.mjs

Describe the bug

If I use a configuration file for vueI18n, there is an error during app building: Zrzut ekranu 2023-05-16 o 11 25 17

And also during preview: Zrzut ekranu 2023-05-16 o 11 34 36

It doesn’t matter if I use the default file name i18n.config.ts or set a custom path with i18n.vueI18n in nuxt.config.ts.

Additional context

No response

Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 3
  • Comments: 15

Most upvoted comments

It’s not super clear from the changelog, but since 8.0.0-beta.12 this was added to the docs under getting started/setup: packagejson After changing this it worked again for me.

Same here 🫣

Same problem:

Version: 8.0.0-beta.12

Problem only appear on linux. Windows works well.

Im trying to put type:module on my package.json but it doesnt work.

nuxt.config.ts

[
    '@nuxtjs/i18n',
    {
        strategy: 'prefix_except_default',
        defaultLocale: 'es',
        locales: [
            {
                code: 'en',
                iso: 'es-ES'
            },
            {
                code: 'it',
                iso: 'it-IT'
            },
            {
                code: 'es',
                iso: 'es-ES'
            }
        ],
        detectBrowserLanguage: {
            useCookie: true,
            cookieKey: 'i18n_redirected',
            redirectOn: 'root' // recommended
        },

        vueI18n: './src/data/i18n/i18n.config.ts'
    }
]

i18n.config.ts

import es from './langs/es.json'
import en from './langs/en.json'
import it from './langs/it.json'

export default defineI18nConfig(() => ({
    legacy: false,
    locale: 'es',
    messages: {
        es,
        en,
        it
    }
}))

i18n.options.39f40470.js:1 GET xxxxxxxxxxx/i18n/prerender/de34d178.js net::ERR_ABORTED 500

Sorry, poor our changelog. from v8.0.0-beta.12, we need to setup "type": "module" to package.json.

Also having this issue.