-
Notifications
You must be signed in to change notification settings - Fork 333
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
[SPIKE] Configure Babel to add ES shims polyfills #4301
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
October 4, 2023 10:10
Inactive
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for 9234e61 |
colinrotherham
force-pushed
the
babel-polyfills
branch
from
October 5, 2023 16:37
368a66d
to
c9cc644
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
October 5, 2023 16:37
Inactive
colinrotherham
force-pushed
the
babel-polyfills
branch
from
October 17, 2023 09:52
c9cc644
to
376a0c4
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
October 17, 2023 09:52
Inactive
colinrotherham
force-pushed
the
babel-polyfills
branch
from
October 24, 2023 09:20
376a0c4
to
283917f
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
October 24, 2023 09:20
Inactive
colinrotherham
force-pushed
the
babel-polyfills
branch
from
October 31, 2023 12:46
283917f
to
701b232
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
October 31, 2023 12:46
Inactive
colinrotherham
changed the title
[SPIKE] Configure Babel to add polyfills
[SPIKE] Configure Babel to add ES shims polyfills
Oct 31, 2023
colinrotherham
force-pushed
the
babel-polyfills
branch
from
October 31, 2023 17:17
701b232
to
59c752c
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
October 31, 2023 17:17
Inactive
colinrotherham
force-pushed
the
babel-polyfills
branch
from
November 27, 2023 14:54
59c752c
to
afbfefc
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
November 27, 2023 14:54
Inactive
colinrotherham
force-pushed
the
babel-polyfills
branch
from
November 27, 2023 19:02
afbfefc
to
c6b31d5
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
November 27, 2023 19:02
Inactive
colinrotherham
force-pushed
the
babel-polyfills
branch
from
November 28, 2023 13:31
c6b31d5
to
cef6a0c
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
November 28, 2023 13:31
Inactive
colinrotherham
force-pushed
the
babel-polyfills
branch
2 times, most recently
from
November 30, 2023 13:56
1a09dd5
to
259bedb
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
November 30, 2023 13:57
Inactive
colinrotherham
force-pushed
the
babel-polyfills
branch
from
December 11, 2023 14:05
259bedb
to
ec5bebc
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
December 11, 2023 14:05
Inactive
colinrotherham
force-pushed
the
babel-polyfills
branch
from
December 11, 2023 14:48
ec5bebc
to
7fbe825
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
December 11, 2023 14:48
Inactive
colinrotherham
force-pushed
the
babel-polyfills
branch
from
December 14, 2023 19:40
7fbe825
to
21e8f56
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
December 14, 2023 19:40
Inactive
colinrotherham
force-pushed
the
babel-polyfills
branch
from
January 8, 2024 17:39
21e8f56
to
eb4ce76
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
January 8, 2024 17:40
Inactive
This option is no longer `@babel/preset-env` specific since v7.13.0
Opera Mobile has relaunched for Android using Chromium but the compatibility data still thinks lots of features are unsupported: ``` The es-shims polyfill added the following polyfills: Array.prototype.every { "opera_mobile":"73" } Array.prototype.indexOf { "opera_mobile":"73" } Array.prototype.keys { "opera_mobile":"73" } Date.now { "opera_mobile":"73" } Function.prototype.name { "opera_mobile":"73" } Object.entries { "opera_mobile":"73" } String.prototype.split { "opera_mobile":"73" } String.prototype.trim { "opera_mobile":"73" } ``` See related issues: browserslist/browserslist#766 babel/babel#15711
Rollup will log a warning for code requiring polyfills: > (!) Unresolved dependencies > https://rollupjs.org/troubleshooting/#warning-treating-module-as-external-dependency > error-cause/Error (imported by "src/govuk/errors/index.mjs") Babel will also log a warning: > Some polyfills have been added but are not present in your dependencies. > > Please run one of the following commands: > npm install --save error-cause@^1.0.1 > yarn add error-cause@^1.0.1 See ES shims on GitHub: https://github.com/es-shims
Although this polyfill is required for feature complete Error support, we don’t use the `.cause` property yet ``` The es-shims polyfill added the following polyfills: Error cause { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } ```
Although this polyfill is required for bug-free `[].includes()` in legacy Firefox versions with sparse arrays, we don’t have any: ``` The es-shims polyfill added the following polyfills: Array.prototype.includes { "firefox":"60" } ```
colinrotherham
force-pushed
the
babel-polyfills
branch
from
February 19, 2024 19:58
eb4ce76
to
9234e61
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4301
February 19, 2024 19:59
Inactive
Closing for housekeeping reasons, as this spike seems unlikely to be resolved at this time. The related issue remains open for comments. #3948 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds the Babel polyfill provider ES shims via:
https://www.npmjs.com/package/babel-plugin-polyfill-es-shims
This is part of a two spike series:
Findings
Lots of polyfills are missing in ES shims when compared to core-js in #4557
We also have some unwanted bug fixes:
Array.prototype.includes
polyfill to avoid bugsError.prototype.cause
polyfill to avoid bugsRemaining issues
es6-module
but Babel disagrees@rollup/plugin-commonjs
adds ES module wrappers to polyfills@rollup/plugin-babel
adds helpers to avoid ES module wrappersdist/govuk/node_modules
notdist/govuk/vendor
Automatic polyfills
When Babel was added we chose "transforms only" without polyfills (see decision record)
This PR ensures early investigations aren't lost for:
Decision record implications
Since Babel with "transforms only" silently skips polyfills, we noted that care must be taken:
This spike PR ensures:
i.e. Support for both polyfills and protection from missed polyfills all-in-one