News for hackers. Stuff that matters.
Re:React 16 by realityking on Tuesday September 26, 2017 @05:22PM (#15342629)
Unfortunately pulling in the now required polyfills for ES6 Map and Set can add 40kb :/

(the 40kb are with core-js, will need to look for something smaller)

Re:React 16 by chrismorgan on Wednesday September 27, 2017 @01:59AM (#15345249)
For Topicbox (which doesn’t use React, but that’s irrelevant), I decided a good signal to check was Object.values; if it’s missing, we include core-js. Thus, older browsers (IE, Safari≤10.0, iOS≤10.2, Chrome≤53, Firefox≤46 and Edge≤13?) will pull that in, but recent versions of all browsers won’t need the weight (the check is very light, and the overhead roughly `Object.values||require('core-js')`), and you have a solid and dependable ES6+ base to build on.
Re:React 16 by realityking on Wednesday September 27, 2017 @05:15AM (#15346075)
I assume you're then dynamically loading core-js when it's required? Dynamic module loading is something we've avoided so far, maybe we need to start looking into that.
Re:React 16 by chrismorgan on Thursday September 28, 2017 @12:31AM (#15354617)
Re:React 16 by danabramov on Tuesday September 26, 2017 @05:57PM (#15342864)
They're only required if you target IE10 or lower.
Re:React 16 by realityking on Wednesday September 27, 2017 @05:14AM (#15346073)
Does that mean React is only using the save subset of Map/Set methods that are supported by IE11? That'd one great news and should be documented.
Re:React 16 by Bahamut on Tuesday September 26, 2017 @06:10PM (#15342984)
Some older versions of Safari as well I believe since Safari had shipped a broken implementation prior to becoming ES2015 compliant.
Re:React 16 by danabramov on Tuesday September 26, 2017 @07:31PM (#15343579)
If you have specific data about what was broken please share in an issue report so we can amend the docs if necessary. Thanks!
Re:React 16 by Bahamut on Tuesday September 26, 2017 @10:46PM (#15344513)
Here is one issue where I saw some comments on the broken Map implementation: https://github.com/google/traceur-compiler/issues/1810

Admittedly, this is an older browser at this point (Safari 11 formally shipped yesterday), but I remember it biting a workplace I was at 2 1/2 years ago & we had to polyfill Map and Set. I believe this was fixed in Safari 9.

I would like to report it on GitHub, but unfortunately I think it would violate my employment contract until I complete the process to get approval to do open source work.

Re:React 16 by spicyj on Wednesday September 27, 2017 @01:32AM (#15345148)
Good realization. We were already using Map/Set polyfills in our apps so didn't notice the cost as much. I imagine it should be possible to polyfill with a much smaller footprint; maybe we can find another to recommend. As Dan notes Map+Set polyfills are also not needed in newer browsers.