mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.11k stars 2.21k forks source link

Adopt object spread and polyfill Object.assign #8283

Open mourner opened 5 years ago

mourner commented 5 years ago

Currently we use a custom extend utility function because Object.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:

asheemmamoowala commented 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

mourner commented 5 years ago

@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.

karimnaaji commented 3 years ago

Addressed as part of the IE11 deprecation in v2.

ryanhamley commented 2 years ago

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.