I18n-module: i18n fails missing ./langs folder

Created on 4 Aug 2020  ·  3Comments  ·  Source: nuxt-community/i18n-module

Version

nuxt-i18n: 6.13.3
nuxt: 2.14.0

Nuxt configuration

mode:

  • [x] universal

Nuxt-i18n configuration

export default {
  modules: ['nuxt-i18n'],
  i18n: {
    locales: [
      {
        name: 'German',
        code: 'de',
        iso: 'de-DE',
        file: 'de-DE.json',
      },
    ],
    defaultLocale: 'de',
    lazy: true,
    langDir: 'locales/',
  },
}

Steps to reproduce

Use above config with only one language.

What is Expected?

It just works™ as it worked until yesterday. :)

What is actually happening?

With the above config, i18n expects a langs folder. However, since only one language is present no langs folder is created, thus the build fails.

ERROR in ./dist/nuxt-i18n/utils.js
Module not found: Error: Can't resolve './langs' in '/my/path/to/project/dist/nuxt-i18n'
 @ ./dist/nuxt-i18n/utils.js 87:19-89:36
 @ ./dist/nuxt-i18n/plugin.main.js
 @ ./dist/index.js
 @ ./dist/client.js
 @ multi ./dist/client.js

Before one might ask the question why we only use one language: More languages are a requirement for the future, so we're already preparing the project from the get-go. Also i18n is a great way to work with language files rather than hardcoding stuff. ;)

bug 🐛

Most helpful comment

Nice corner case. Fixed with #825 and released in v6.13.4.

All 3 comments

It seems, this was introduced by @rchl in https://github.com/nuxt-community/i18n-module/commit/6ed4ae616a0c9b555e3966c169886d3650427e07#diff-f75214dd6d844a635c08eace65df6463

Maybe you could be so kind to have another look? ;)

Nice corner case. Fixed with #825 and released in v6.13.4.

Thank you very, very much for this quick fix. :)

Was this page helpful?
0 / 5 - 0 ratings