Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error after migrate to Next.js 9.0.0 #382

Closed
aralroca opened this issue Jul 8, 2019 · 3 comments
Closed

Error after migrate to Next.js 9.0.0 #382

aralroca opened this issue Jul 8, 2019 · 3 comments

Comments

@aralroca
Copy link

aralroca commented Jul 8, 2019

Describe the bug

After migrate to the latest version of Next.js, the next-i18next package is throwing an error after npm run dev

TypeError: Cannot read property 'detection' of undefined

My i18n config:

{
  "defaultLanguage": "es",
  "localeExtension": "json",
  "localePath": "static/locales",
  "localeStructure": "{{lng}}/{{ns}}",
  "localeSubpaths": "all",
  "otherLanguages": [
    "es",
    "en",
    "de",
    "it",
    "fr"
  ],
  "pluralSeparator": "_",
  "simplifyPluralSuffix": true,
  "detection": {
    "order": [
      "querystring",
      "cookie",
      "navigator"
    ]
  }
}

Import using common.js

const NextI18Next = require('next-i18next').default

Occurs in next-i18next version

Steps to reproduce

Just migrate from [email protected] to [email protected] and run the app with npm run dev.

Expected behaviour

I expect to run the app without any crash. As in next 8.1.0 version.

Screenshots

image

OS (please complete the following information)

  • Device: MBP 2018 13
  • Node: v11.8.0
@aralroca aralroca changed the title Migrating to Next.js 9.0.0 Error after migrate to Next.js 9.0.0 Jul 8, 2019
@isaachinman
Copy link
Contributor

isaachinman commented Jul 8, 2019

I believe the NextJs team have changed some of their Babel internals. I'll take a look when I have time.

@aralroca
Copy link
Author

aralroca commented Jul 8, 2019

I realized that this is happening only using this in my next.config.js:

const withTM = require('next-transpile-modules')

// ...

const hasModuleTranspilation = withTM({
  transpileModules: ['next-i18next'],
  ...nextConfig
})

That I did to solve this another problem commented here: #290 (comment)

So I guess is not an issue of this library. I can close it.

@aralroca aralroca closed this as completed Jul 8, 2019
@isaachinman
Copy link
Contributor

Ah okay, makes sense. It does indeed sound like a module problem. Good luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants