Add CoreJS polyfills to modern build #20676
Open
+2
−34
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.
Proposed change
Currently, we deliberately ignore all CoreJS polyfills for the modern build. This change allows Babel to inject them just like the legacy build, except obviously with the modern targets. This ensures that when we serve the modern build to an older browser, it gets the polyfills it needs (so in reality this is a bug fix for any such problems). It also allows us to more seamlessly develop with new ECMA features as they begin to be implemented in browsers.
This is a perfectly valid PR on its own, but is meant to compliment #16506. This increases the bundle size a bit because the modern target browsers are so old, and then that PR would then eliminate nearly all of the increase by shifting the targets to be much more modern.
This change also removes the custom polyfill we manually add for
Array.prototype.flat
. It's unnecessary as the equivalent polyfill from CoreJS will be injected where needed.Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: