-
Notifications
You must be signed in to change notification settings - Fork 799
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
Use DEWP's new auto-wp-polyfill support #39629
Conversation
`@wordpress/dependency-extraction-webpack-plugin` has added the ability to detect a magic `/* wp:polyfill */` comment and only add `wp-polyfill` as a dependency if that is found. Since `wp-polyfill` is just a custom build of `core-js`, the intention is that `babel-plugin-polyfill-corejs3` (maybe via `@babel/preset-env`) would be used and then a custom Babel plugin would replace the `core-js` imports with the magic comment. This updates our Babel config to do just that, and removes the blanket addition of `wp-polyfill` via `injectPolyfill` or otherwise.
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Backup plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Boost plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Search plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Social plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Starter Plugin plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Protect plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Videopress plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Migration plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Mu Wpcom plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Automattic For agencies client plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Classic Theme helper plugin plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Amazing!
This one is a bummer, because it'll force wp-polyfill to frontend of many sites on each post. cc @automattic/vertex in case anything could be done about it. Not a blocker at all for this PR. |
@simison I believe |
If we want Verbum not to check for polyfills, it looks like it's already set up so we would just have to change
to do [ '@automattic/jetpack-webpack-config/babel/preset', { autoWpPolyfill: false } ] instead. Looking back at #34993 it wasn't clear to me whether dropping injectPolyfill in 69dd842 was intentional or accidental.
P.S. wp-polyfill is being triggered for Verbum because of use of |
Yes, that's consistent with what I've seen, and with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I obviously haven't tested all of these packages, but I like where this is going!
`@wordpress/dependency-extraction-webpack-plugin` has added the ability to detect a magic `/* wp:polyfill */` comment and only add `wp-polyfill` as a dependency if that is found. Since `wp-polyfill` is just a custom build of `core-js`, the intention is that `babel-plugin-polyfill-corejs3` (maybe via `@babel/preset-env`) would be used and then a custom Babel plugin would replace the `core-js` imports with the magic comment. This updates our Babel config to do just that, and removes the blanket addition of `wp-polyfill` via `injectPolyfill` or otherwise.
Proposed changes:
@wordpress/dependency-extraction-webpack-plugin
has added the ability to detect a magic/* wp:polyfill */
comment and only addwp-polyfill
as a dependency if that is found. Sincewp-polyfill
is just a custom build ofcore-js
, the intention is thatbabel-plugin-polyfill-corejs3
(maybe via@babel/preset-env
) would be used and then a custom Babel plugin would replace thecore-js
imports with the magic comment.This updates our Babel config to do just that, and removes the blanket addition of
wp-polyfill
viainjectPolyfill
or otherwise.Effects
Removes unnecessary wp-polyfill from the following:
divi-editor/index.js
,player-bridge.js
, and block view.jsAlso it adds wp-polyfill as a dependency for a few things that were missing it before:
inline-liar.js
jetpack-forms-dashboard.js
block-inserter-modifications.js
newspack-blocks-blog-posts-editor.js
newspack-blocks-blog-posts-view.js
newspack-blocks-carousel-editor.js
tags-education.js
verbum-comments.js
wpcom-block-description-links.js
wpcom-block-editor-nux.js
wpcom-blocks-event-countdown-editor.js
wpcom-blocks-timeline-editor.js
wpcom-global-styles-editor.js
The following specifically weren't changed:
Other information:
Jetpack product discussion
Fixes #39452
Does this pull request change what data or activity we track or use?
Testing instructions:
wp-polyfill
on the frontend anymore.P.S. If building locally to test, you may want to delete any stray
.cache/
directories first. Babel seems not to notice changes in the preset and so incorrectly reuses cache entries from older builds.