Experiment: Test private Interactivity API webpack modifications for WP Core#54311
Experiment: Test private Interactivity API webpack modifications for WP Core#54311luisherranz wants to merge 9 commits into
Conversation
6e96c26 to
6e68cab
Compare
|
Some updates:
Now the files are correctly enqueued, although Preact is giving an error. My guess is that it might be related to React being in the bundle. I'll take a look at it tomorrow. |
|
Size Change: -1.01 kB (0%) Total Size: 1.52 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 6e68cab. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6149184457
|
Confirmed. |
|
Ok, everything is working great now. I consider this experiment finished and successful. All the modifications have been applied to the Webpack configuration, and we only need to include this PHP code for each interactive block, which is compatible with Gutenberg: if (
isset( $wp_scripts->registered['wp-block-navigation-view'] ) &&
! in_array( 'wp-interactivity', $wp_scripts->registered['wp-block-navigation-view']->deps, true )
) {
$wp_scripts->registered['wp-block-navigation-view']->deps[] = 'wp-interactivity';
}The next steps are:
|
|
I've ported the changes to WordPress Core and everything seems to be working fine: I'll close this PR as finished. If you have feedback, please share it the WordPress Core one. |
What?
This is not meant to be merged in Gutenberg.
It's just for testing a new Webpack configuration to make the Interactivity API private in WP Core. If this is successful, we'll try in WP Core own webpack files.
Why?
More context about why we want to switch the Interactivity API to a private version here:
How?
By modifying Webpack so it bundles the Interactivity API runtime as a private chunk of the interactive blocks (Navigate, Image…).
Screenshots or screencast
https://www.loom.com/share/7e3ff56aaa934350b8e309cad04ee597
Remaining tasks
reactfrom being bundled.wp-interactivityto all the block scripts.This is another video explaining the
reactproblem:https://www.loom.com/share/54962188983a4b85a8d8e970acb1574a