Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize distributed bundle #6391

Closed
anandthakker opened this issue Mar 24, 2018 · 2 comments
Closed

Modernize distributed bundle #6391

anandthakker opened this issue Mar 24, 2018 · 2 comments

Comments

@anandthakker
Copy link
Contributor

IE 11 is the only browser we target that doesn't support the ES2015 that we currently compile to ES5:

screen shot 2018-03-19 at 3 07 34 pm

Via babel-preset-env. According to MDN, Edge does support basic destructuring, just not 'rest' for arrays/objects.

I propose that we:

  • Modernize our main bundle (dist/mapbox-gl.js, https://api.tiles.mapbox.com/mapbox-gl-js/VERSION/mapbox-gl.js) to un-transpiled ES2015 code.
  • Continue to support IE 11 by distributing a separate compatibility bundle as dist/mapbox-gl.ie11.js / https://api.tiles.mapbox.com/mapbox-gl-js/VERSION/mapbox-gl.ie11.js.

There are benefits to a modernized bundle for users who don't need IE 11 support:

  • It'll be a bit smaller -- not tons, but with a 500K+ bundle, every bit counts.
  • If it's not already faster, I think it will be soon: it seems pretty likely that JS engines will start including optimizations that are specific to ES2015 constructs that wouldn't apply to their ES5-compiled counterparts.

(We could also do this the other way: keep dist/mapbox-gl.js as-is, but start destributing dist/mapbox-gl.es2015.js or something)

@andrewharvey
Copy link
Collaborator

While I like the idea, I think it makes more sense to be opt in (es2015 build) for the time being rather than opt out (ie11 build). I still see a fair amount of users on IE11 or on outdated Chrome/Firefox builds.

@anandthakker
Copy link
Contributor Author

it seems pretty likely that JS engines will start including optimizations that are specific to ES2015 constructs that wouldn't apply to their ES5-compiled counterparts.

One example of such an optimization: looks like object spread syntax will be faster than a transpiled equivalent (or Object.assign) in v8: https://twitter.com/bmeurer/status/1015105293301280768

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants