Skip to content

loadLocaleFrom() crashes the Node@16 #1135

Answered by crs1138
crs1138 asked this question in Q&A
Discussion options

You must be logged in to vote

The culprit seems to be the parameter of the import() function, as the following code works.

module.exports = {
  locales: ['en', 'ca', 'es', 'cs'],
  defaultLocale: 'en',
  pages: {
    '*': ['common'],
    '/[lang]': ['home'],
    '/[lang]/second-page': ['home'],
    '/[lang]/[slug]': ['home'],
  },
  loadLocaleFrom: (locale, namespace) => {
    console.log('i18n.js > loadLocaleFrom() :::', { i18nLocale })

    return import(`./honza/${locale}/${namespace}.json`)
      .then((m) => m.default)
      .catch((e) => console.error(e))
  },
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@crs1138
Comment options

Answer selected by crs1138
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant