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

ui: Update browser targets #9729

Merged
merged 3 commits into from
Feb 11, 2021
Merged

Conversation

johncowen
Copy link
Contributor

@johncowen johncowen commented Feb 8, 2021

Consul UI pre 1.9 used a mainly ES5 style of javascript, this meant that the majority of the code did not need any ES6 to ES5 babel transpilation or shim code, and our javascript payload was roughly:

Consul UI: 116KB gzipped
Dependencies: 374KB gzipped

As of 1.9 we started moving towards using Ember's new Octane edition, which felt much more ES6-y. So as well as beginning to update all of our components to use glimmer components, we also updated the style of how we write the UI to use ES6 javascript rather than ES5. This meant that (with our existing browser targets file), much of this was being transpiled using babel into ES5 javascript, giving a rough javascript payload of:

Consul UI: 229KB gzipped
Dependencies: 460KB gzipped

That's roughly 200KB gzipped of payload difference between Consul UI 1.8 and 1.9 split roughly 50/50 between app and dependencies, mainly due to moving to a ES6 style of writing javascript.

This PR alters our browser targets file to target newer browsers and transpile less.

We took a good while looking into this, basing the following on the fact that we generally use these ES6 features:

  1. Template literals
  2. Native classes
  3. Arrow functions
  4. Async/await
  5. Default arguments/parameters
  6. Destructuring
  7. The odd generator

We found the newest feature here (surprisingly) was async/await, which landed in Chrome 55, FF 53, Safari 10, Edge 15, which "release date wise" takes us to around the end of 2016 for all of these 'evergreen' browsers, probably a reasonable date.

The slight caveat here is a garbage collection bug for tagged Template Literals in Safari 12, which considering our current usage of template literals wouldn't affect us.

This brings us to a browserlist of: (bumped Safari version to get non-transpiled template literals)

'Chrome 55', 'Firefox 53', 'Safari 13', 'Edge 15'

This brings us back down to:

Consul UI: 184KB gzipped
Dependencies: 431KB gzipped

A ~71KB reduction on 1.9, not close to the 200KB between 1.8 and 1.9 but a good reduction (although I'm still confused as to where we gained 130KB 🤷 )

We also took the opportunity to remove ember-cli-autoprefixer here as the above browserlist supports all the things that autoprefixer was prefixing for us (mainly MS flavoured grid and flexbox).

There's probably a little more we can do here but nothing quite like a 70KB reduction, so we'll probably leave that for future PRs.

Overall this frees us up to make use of some other nice JS dependencies for upcoming features with a clear conscience 😄

Consul UI 1.8

1 8

Consul UI 1.9

1 9

Consul UI this PR

now

@johncowen johncowen added the theme/ui Anything related to the UI label Feb 8, 2021
@johncowen johncowen requested a review from kaxcode February 8, 2021 13:14
@hashicorp-ci
Copy link
Contributor

🤔 Double check that this PR does not require a changelog entry in the .changelog directory. Reference

Copy link
Contributor

@kaxcode kaxcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 LGTM

@vercel vercel bot temporarily deployed to Preview – consul-ui-staging February 11, 2021 09:54 Inactive
@vercel vercel bot temporarily deployed to Preview – consul February 11, 2021 09:54 Inactive
@johncowen johncowen merged commit 369637a into master Feb 11, 2021
@johncowen johncowen deleted the ui/chore/remove-browser-targets branch February 11, 2021 10:03
@hashicorp-ci
Copy link
Contributor

🍒 If backport labels were added before merging, cherry-picking will start automatically.

To retroactively trigger a backport after merging, add backport labels and re-run https://circleci.com/gh/hashicorp/consul/326578.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/ui Anything related to the UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants