-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Tiled gallery block: add babel-polyfill #31228
Conversation
We should probably consider using |
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.
Thanks for this, left a few notes I'd like to consider before merging.
/** | ||
* External dependencies | ||
*/ | ||
import '@babel/polyfill'; |
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'd like to compare the size change for the view script with this addition.
If we depend on wp-polyfill
we can share the cost of the dependency with any other code that may be using it.
I'd like to consider that before moving ahead with this.
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.
wp-polyfill (v7.0.0) 30.7 KB minified
view.js when building minified production versions:
- without polyfill 7.96 KiB
- with polyfill 87.6 KiB
So looks like we're better enqueing wp-polyfill as an immediate fix and then later on we'll fix the builder.
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.
So looks like we're better enqueing wp-polyfill as an immediate fix
FYI @jeffersonrabb and @ockham since Slideshow block also includes polyfill:
We've meant to look into this — ideally SDK builder would just take care of this and polyfill things that are only needed. Calypso would also benefit instead of adding it manually? |
Yes! This is handled for us in Calypso and I'd expect the build tools to provide the same functionality. |
Closing this as we're going ahead with Automattic/jetpack#11487 instead. Build tooling polyfill follow-ups: #31231 |
The previous version of Tiled gallery had `wp-i18n` as a dependency which depends on `wp-polyfill` (https://github.com/WordPress/WordPress/blob/029fcf7791e425303d14328471ed61e9f0ecc1e1/wp-includes/script-loader.php#L424). We removed view side deps in #11326 By adding `wp-polyfill`, we ensure that `isNaN`, `Array.from` and other methods that need polyfilling to work in IE11. Editor side dependency isn't _really_ needed here since many other dependencies pull in wp-polyfill as well, but seems like it's good to be explicit? This fix is an alternative to Automattic/wp-calypso#31228 because of size considerations: Automattic/wp-calypso#31228 (comment): >wp-polyfill (v7.0.0) 30.7 KB minified > >view.js when building minified production versions from Automattic/wp-calypso#31228: >- without polyfill 7.96 KiB >- with polyfill 87.6 KiB #### Changes proposed in this Pull Request: - Add `wp-polyfill` as a dependency for tiled gallery block view side and editor side. #### Testing instructions: - Spin up jurassic ninja with this branch gutenpack-jn - Add Tiled gallery to a page where no other blocks are not present (to ensure you're not loading `wp-polyfill` via other sources) - open the saved page in IE11 and observe no more fatal errors in debugger Fixes Automattic/wp-calypso#31224 #### Proposed changelog entry for your changes: Fix regression that caused Tiled Gallery not function in Internet Explorer 11 browsers anymore.
The previous version of Tiled gallery had `wp-i18n` as a dependency which depends on `wp-polyfill` (https://github.com/WordPress/WordPress/blob/029fcf7791e425303d14328471ed61e9f0ecc1e1/wp-includes/script-loader.php#L424). We removed view side deps in #11326 By adding `wp-polyfill`, we ensure that `isNaN`, `Array.from` and other methods that need polyfilling to work in IE11. Editor side dependency isn't _really_ needed here since many other dependencies pull in wp-polyfill as well, but seems like it's good to be explicit? This fix is an alternative to Automattic/wp-calypso#31228 because of size considerations: Automattic/wp-calypso#31228 (comment): >wp-polyfill (v7.0.0) 30.7 KB minified > >view.js when building minified production versions from Automattic/wp-calypso#31228: >- without polyfill 7.96 KiB >- with polyfill 87.6 KiB #### Changes proposed in this Pull Request: - Add `wp-polyfill` as a dependency for tiled gallery block view side and editor side. #### Testing instructions: - Spin up jurassic ninja with this branch gutenpack-jn - Add Tiled gallery to a page where no other blocks are not present (to ensure you're not loading `wp-polyfill` via other sources) - open the saved page in IE11 and observe no more fatal errors in debugger Fixes Automattic/wp-calypso#31224 #### Proposed changelog entry for your changes: Fix regression that caused Tiled Gallery not function in Internet Explorer 11 browsers anymore.
Changes proposed in this Pull Request
Testing instructions
wp-polyfill
to cover the issue,Fixes #31224