Skip to content

Commit

Permalink
Refactor for new Script Modules API
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherranz committed Jan 24, 2024
1 parent 19185a3 commit 4e9d82a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ public function register_script_modules() {
array(),
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
);

wp_register_script_module(
'@wordpress/interactivity/router',
gutenberg_url( '/build/interactivity/router.min.js' ),
array( '@wordpress/interactivity' ),
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/block-library/src/query/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ function register_block_core_query() {

wp_register_script_module(
'@wordpress/block-library/query',
'/wp-content/plugins/gutenberg/build/interactivity/query.min.js',
gutenberg_url( '/build/interactivity/query.min.js' ),
array(
'@wordpress/interactivity',
array(
'id' => '@wordpress/interactivity/router',
'type' => 'dynamic',
'id' => '@wordpress/interactivity/router',
'import' => 'dynamic',
),
),
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
Expand Down
4 changes: 2 additions & 2 deletions packages/e2e-tests/plugins/interactive-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ function () {
array(
'@wordpress/interactivity',
array(
'id' => '@wordpress/interactivity/router',
'type' => 'dynamic',
'id' => '@wordpress/interactivity/router',
'import' => 'dynamic',
),
),
filemtime( $view_file )
Expand Down

0 comments on commit 4e9d82a

Please sign in to comment.