Open mourner opened 5 years ago
Isn't this already done automatically in our rollup configuration at : https://github.com/mapbox/mapbox-gl-js/blob/42f00ac3e963f6dda9f4ed5390201e5ff25fa41a/build/rollup_plugins.js#L20
@asheemmamoowala what this does is tell Buble to transpile object spreads to Object.assign
calls. But this will break IE11 because it doesn't have Object.assign
. To make this work, we need to include a polyfill in the bundle.
Addressed as part of the IE11 deprecation in v2.
The issue here is no longer IE11 since GL JS no longer supports it, but some build systems fail when encountering the Object spread notation. See https://github.com/mapbox/mapbox-gl-js/issues/11266 for an example. We probably don't need to polyfill Object.assign either.
Currently we use a custom
extend
utility function becauseObject.assign
isn't supported in IE11.However, if we polyfilled
Object.assign
in IE, we could switch to object spread ({...obj}
) syntax across the code base, which provides many benefits:Object.assign
.extend
and all code that uses it in Flow is really hard, which I discovered while working on #8281. It's much easier with spreads because it syntactically indicates the full shape of an object from the start — no type conversions/refinements need to happen to transform an object through multiple extensions.