codesandbox-client icon indicating copy to clipboard operation
codesandbox-client copied to clipboard

core-js >=3.12 throws errors `Target is not iterable`

Open satanTime opened this issue 5 years ago • 19 comments

🐛 bug report

Preflight Checklist

  • [x] I have read the [Contributing Guidelines][contributing] for this project.
  • [x] I agree to follow the [Code of Conduct][code_of_conduct] that this project adheres to.
  • [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.

Description of the problem

Local usage of core-js >= 3.12 doesn't have issues, whereas codesandbox throws Target is not iterable.

How has this issue affected you? What are you trying to accomplish?

I try to keep dependencies up to date.

To Reproduce

  • change in dependencies the version of core-js to 3.11.3
  • click refresh in the builtin browser
  • wait when the app has been rendered
  • change in dependencies the version of core-js to 3.12.0
  • click refresh in the builtin browser
  • the error appears

if you download the project and run it locally, it works correctly.

satanTime avatar Jul 04 '21 10:07 satanTime

Maybe this is a combination of package versions because every version of core-js I try is broken with that error

rocifier avatar Jul 07 '21 04:07 rocifier

Nevermind, I wasn't hitting refresh every time. Confirmed it is broken since 3.12.0

rocifier avatar Jul 07 '21 04:07 rocifier

Hi, Any news?

NickMitrokhin avatar Sep 03 '21 07:09 NickMitrokhin

Hi @smhutch,

I hope this finds you well.

Could you provide a brief update on this issue?

satanTime avatar Sep 04 '21 10:09 satanTime

From this version, core-js does not accept not pretty correct third-party Symbol polyfills that break core-js, so it's a conflict with another polyfill.

zloirock avatar Sep 04 '21 11:09 zloirock

The thing which confuses me is that it actually works locally with the same setup, or on stackblitz. The only place where I see this error is codesandbox.

satanTime avatar Sep 04 '21 11:09 satanTime

@DeMoorJasper can you please take a look at this?

lbogdan avatar Sep 06 '21 08:09 lbogdan

Seems to work fine to me, can somebody create a reproduction?

DeMoorJasper avatar Sep 06 '21 17:09 DeMoorJasper

@DeMoorJasper https://codesandbox.io/s/jovial-hawking-lx4oy (just change "core-js": "3.12.0", in package.json from angular template as in the first post said)

babich-a avatar Sep 06 '21 18:09 babich-a

@DeMoorJasper, I would assume you forgot to refresh the builtin browser manually.

satanTime avatar Sep 06 '21 18:09 satanTime

@babich-a Thank you I can reproduce it now, will look into (and hopefully fix) it tomorrow

DeMoorJasper avatar Sep 06 '21 19:09 DeMoorJasper

Hi @DeMoorJasper,

could you provide an update on the issue?

satanTime avatar Sep 14 '21 06:09 satanTime

@satanTime looking into it today, something came up preventing me from looking into this sooner.

Found the issue, it's due to core-js relying on process.versions.v8 to detect if the environment has native Symbol support which is not really an option in the browser, but when using nodeJS polyfills (like we do) it is set to 0.0. So this is a bug in core-js cc @zloirock

~I'll change the process polyfill (https://github.com/jvilk/bfs-process/blob/master/ts/process.ts) to work around this...~ the ideal solution would be that core-js doesn't rely on nodeJS globals if it's in a browser environment...

Hacked around it and opened a PR, will put it in production once the tests pass

DeMoorJasper avatar Sep 14 '21 08:09 DeMoorJasper

Hi @zloirock should we create an issue in core-js repo regarding what @DeMoorJasper is proposing?

the ideal solution would be that core-js doesn't rely on nodeJS globals if it's in a browser environment...

satanTime avatar Oct 17 '21 09:10 satanTime

@satanTime the problem is that NodeJS also could emulate browser environment. We couldn't just stop check the V8 version in feature detection because it will cause a critical slowdown (100x+) in some cases even if nothing is polyfilled because of V8 whims like this. I'll try to add a workaround, but mainly it should be fixed on NodeJS polyfills side - it's their bug - .v8 should not be '0.0' anyway - if you don't know the engine version - just miss it instead of reporting the incorrect result.

zloirock avatar Oct 17 '21 19:10 zloirock

It seems [email protected] has a fix for this problem. @zloirock can you confirm?

babich-a avatar Nov 11 '21 13:11 babich-a

Yes, I added a workaround for this bfs-process bug.

zloirock avatar Nov 11 '21 13:11 zloirock

Thank you for fixing this @zloirock 🙏 will close this issue

DeMoorJasper avatar Nov 11 '21 16:11 DeMoorJasper

@DeMoorJasper it could be better to specify the actual core-js version in dependencies.

zloirock avatar Nov 11 '21 16:11 zloirock