Build/Test Tools: Restore React Refresh scripts for hot reloading #10725
+249
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Restores the
wp_register_development_scripts()function and associated build infrastructure to enable hot module replacement (HMR) when using@wordpress/scriptswith the--hotflag.The React Refresh scripts were removed in [61438] as part of the Gutenberg build restructuring, but they are still needed for plugin developers using
wp-scripts start --hotfor block development.Changes
react-refreshand@pmmmwh/react-refresh-webpack-pluginnpm dependenciestools/webpack/development.jsto build the development scriptswp_register_development_scripts()inscript-loader.phpdeprecated.phpThe scripts are only registered when
SCRIPT_DEBUGis true and are not loaded during Core tests.Trac Ticket
https://core.trac.wordpress.org/ticket/64393
Test Plan
SCRIPT_DEBUGtotrueinwp-config.php@wordpress/scriptswp-scripts start --hot🤖 Generated with Claude Code