Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/wp-build/templates/module-registration.php.template
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ if ( ! function_exists( '{{PREFIX}}_register_script_modules' ) ) {
$asset_path = $modules_dir . '/' . $module['asset'];
$asset = file_exists( $asset_path ) ? require $asset_path : array();

// Deregister first to override any previously registered version
// (e.g., Core's default modules when running as a plugin).
wp_deregister_script_module( $module['id'] );

wp_register_script_module(
Comment on lines +31 to 35
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{{PREFIX}}_register_script_modules() is attached to wp_default_scripts, which passes a WP_Scripts argument. Because the callback currently declares no parameters, this can trigger an ArgumentCountError on PHP 8+ when the action runs. Align this template with script-registration.php.template by accepting the $scripts parameter (even if unused) or explicitly setting add_action( ..., 10, 0 ) to avoid extra args being passed.

Copilot uses AI. Check for mistakes.
$module['id'],
$base_url . $module['path'] . $extension,
Expand Down
Loading