next-i18next: Unexpected spread operator in bundle?

Describe the bug

It’s a little hard for me to describe, because there are a lot of assumptions. I’m sorry! 🙈

After I replaced the old i18next configuration in a next.js app and added this module instead, tests are failing, because the electron browser of cypress can’t understand some spread operators in the bundle. I couldn’t really find the place where it’s introduced, because comparing compressed bundles is pretty hard and the headless browser of cypress doesn’t really give any further details about the error.

However, I could narrow down the problem to the commit where I added this package.

I’m kind of ignorantly hoping that it’s something simple with this module and you might have an idea what it could be, so that I can avoid reverting back to the old configuration…

Meanwhile, I’ll try to create an example of the problem in a code sandbox. (So that you don’t think I’m completely lazy…) --> see update below

Occurs in next-i18next version

I tested 0.28.0 and 0.32.0.

Steps to reproduce

  • Use in a next.js project
  • Use next/babel in .babelrc
  • Try evaluating the resulting bundle in older browser

Update: I was able to fix the issue by transpiling the module with https://www.npmjs.com/package/next-transpile-modules. Question: Is it intended that this module still needs to be transpiled? Then we can close this issue!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 16 (8 by maintainers)

Most upvoted comments

@emirotin Not exactly what you’re asking for, but I’ve started using next-transpile-modules and added next-i18next to the array of untranspiled modules. Works great 😉