core-js >=3.12 throws errors `Target is not iterable`
🐛 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
- go to https://codesandbox.io/
- click on
Angular angular-cli - wait when the app has been rendered
- change in
dependenciesthe version ofcore-jsto3.11.3 - click refresh in the builtin browser
- wait when the app has been rendered
- change in
dependenciesthe version ofcore-jsto3.12.0 - click refresh in the builtin browser
- the error appears
if you download the project and run it locally, it works correctly.
Maybe this is a combination of package versions because every version of core-js I try is broken with that error
Nevermind, I wasn't hitting refresh every time. Confirmed it is broken since 3.12.0
Hi, Any news?
Hi @smhutch,
I hope this finds you well.
Could you provide a brief update on this issue?
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.
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.
@DeMoorJasper can you please take a look at this?
Seems to work fine to me, can somebody create a reproduction?
@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)
@DeMoorJasper, I would assume you forgot to refresh the builtin browser manually.
@babich-a Thank you I can reproduce it now, will look into (and hopefully fix) it tomorrow
Hi @DeMoorJasper,
could you provide an update on the issue?
@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
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 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.
It seems [email protected] has a fix for this problem. @zloirock can you confirm?
Yes, I added a workaround for this bfs-process bug.
Thank you for fixing this @zloirock 🙏 will close this issue
@DeMoorJasper it could be better to specify the actual core-js version in dependencies.