chore: target frontend build to supported browsers #2653
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously we configured Babel using a browserslist query of
> 0.25%
, which happened to include all the compatibility we needed but also some we didn't (for example, IE 11). Earlier attempts to improve on this were reverted when they broke GDS E-ink units. Now that we no longer have to support this hardware, we can try again.Add a
.browserslistrc
enumerating all the hardware we support and their browser versions. When not configured with an explicittargets
option, Babel uses this file automatically.Remove
regenerator-runtime
andwhatwg-fetch
as dependencies. The former is no longer needed to transform generator syntax as of Babel 7.18, and the latter should no longer be necessary since all of our supported browsers have native Fetch.Configure Babel with
useBuiltIns: "usage"
. This removes the need to explicitly importcore-js
, instead automatically inserting imports to polyfill only the features our code uses and only if they are needed by our target browsers (and since this was the only import left in ourpolyfills
entrypoint, that can be entirely removed).Update Babel packages to their latest versions.
All together this shaves ~120KB off our total shipped code size for each "screen app".
Asana task: https://app.asana.com/1/15492006741476/project/1185117109217413/task/1211080013682284