question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected spread operator in bundle?

See original GitHub issue

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!

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
te-onlinecommented, Mar 27, 2019

@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 😉

0reactions
emirotincommented, Mar 28, 2019

Huh, interesting. Would be thankful for the link as well as some post/article why retranspiling is dangerous

On Thu, Mar 28, 2019, 2:09 AM Isaac Hinman notifications@github.com wrote:

Like if the code is already ES5/6/2017/whatever it shouldn’t harm re-transpiling it, correct?

No, it’s actually dangerous to re-transpile code. Anyways, if you are interested in this topic, a lot of the discussion takes place in the NextJs repo, and I can say that some of the core maintainers are actively working on a solution to this exact issue of dep transpilation.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/isaachinman/next-i18next/issues/191#issuecomment-477348693, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgGCKuGlBmnCzzmqFCcs5CdPsrsyp82ks5va94GgaJpZM4bHdke .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected spread operator in bundle? · Issue #191 - GitHub
If the spread operator is causing a runtime error in your env, you'll need to transpile down. For example, you might need to...
Read more >
Webpack is not building because of javascript spread operator
Webpack is not building because of javascript spread operator ... I get unexpected token error for spread operator, how can I do it...
Read more >
Error Following React Tutorial spread operator is unexpected ...
I am following this freeCodeCamp tutorial: https://youtu.be/4UZrsTqkcW4?t=10660 and am stuck at where the link takes you.
Read more >
Babel 6->7: Error unknown: Unexpected token (spread operator)
I have similar issue on 'unexpected token ...', which is the spread operator error against my @testing-library. Even after I check all plugins...
Read more >
Using the ES7 Spread Operator with Webpack
I'm currently evaluating Redux as a means to tidy up a React app, and in following the examples in the docs came across...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found