core-js: Map & Set Error in 2.5.3
With this code, the code below throw error in Android mobile React-Native jscore.
[...new Map()];
[...new Set()];
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 7
- Comments: 22 (6 by maintainers)
Commits related to this issue
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
- revert https://github.com/zloirock/core-js/commit/e1ffbae3e18730072be48c828070f455a694aabc because of #368 — committed to zloirock/core-js by zloirock 6 years ago
Same issue here, we were getting
Incompatible receiver, Map required
in I.E.11. Reverting back tov2.5.2
fixed it. We use core-js via babel-preset-env, in order to get it fixed the solution is to set the version hard in the resolutions property of the package.json file:Edit: the resolutions section of the package.json file is a yarn feature!
I put together a few details of another instance of this problem: https://github.com/twilio/TwilioChatJsReactNative/issues/9
If it helps at all, when I turn on react native’s remote debugging, the error goes away. I’m also using android 7.1.1.
I was able to “fix” it in react native by doing this:
Ok, I was able to reproduce it… only in FF27. Seems the most cases of this issue was caused conflicts with another not completely correct polyfills. I will revert this change and will publish a patch release soon. This logic will be completely rewritten in
core-js@3
.By looking at what changes from 2.5.2 to 2.5.3 I narrowed the problem down to this change: https://github.com/zloirock/core-js/issues/236 https://github.com/zloirock/core-js/commit/f96b8d8afaebda5f49ac213627218f841c8692b4#diff-cef85cf90f184a55418f175f3c233f2aR219
If I revert
var $default = (!BUGGY && $native) || getMethod(DEFAULT);
tovar $default = $native || getMethod(DEFAULT);
then it works again on Android.FYI @zloirock
I can confirm React Native breaks for me with 2.5.3 and works again after downgrad to 2.5.2
hi I am using 2.5.4 version in my react-native project. But I am facing this error for android.
Can you please advise?
i can reproduce this as well. This occurs on Android API 25, Using Android OS 7.1.1
My RN environment is below.
Environment: OS: macOS High Sierra 10.13.1 Node: 9.2.1 Yarn: Not Found npm: 5.5.1 Watchman: 4.9.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed) react: 16.2.0 => 16.2.0 react-native: 0.53.0 => 0.53.0
This is an issue with any RN component that uses virtualized list. They use Maps in the implementation if you are using the onViewableItemsChanged prop of the virtualized list. This then brings the error TaskQueue: Map is Required!
do what @yamafaktory did and downgrading to 2.5.2 worked for me. Clearly an issue is happening with 2.5.3 and React Native specifically
@zloirock This seems to be reproducible with an app that uses jscore (such as React Native) and a babel shimmed
for..of
block iterating on a Set/Map. This is happening for all versions of Android that I’ve tested.Debugging this a little bit. Definitely caused by https://github.com/zloirock/core-js/commit/6f9792057de00c873bca6373c1c5eecf66cbc45d. Rolling back to one commit before https://github.com/zloirock/core-js/commit/771b32d5d19e8bf7c292c9f7c9f86deddf755824 and its fine. The stack trace I see is
'TaskQueue: Error with task: Incompatible receiver, Map required! _validate-collection.js:3:55
_collection-strong.js:120:25
_iter-define.js:26:57
And the react-native code https://github.com/facebook/react-native/blob/master/Libraries/Lists/ViewabilityHelper.js#L249