Skip to content

Conversation

@youknowriad
Copy link
Contributor

Summary

Restores the wp_register_development_scripts() function and associated build infrastructure to enable hot module replacement (HMR) when using @wordpress/scripts with the --hot flag.

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 --hot for block development.

Changes

  • Adds react-refresh and @pmmmwh/react-refresh-webpack-plugin npm dependencies
  • Creates tools/webpack/development.js to build the development scripts
  • Restores wp_register_development_scripts() in script-loader.php
  • Removes the deprecated stub from deprecated.php

The scripts are only registered when SCRIPT_DEBUG is true and are not loaded during Core tests.

Trac Ticket

https://core.trac.wordpress.org/ticket/64393

Test Plan

  1. Set SCRIPT_DEBUG to true in wp-config.php
  2. Create a plugin using @wordpress/scripts
  3. Run wp-scripts start --hot
  4. Verify hot module replacement works when editing React components

🤖 Generated with Claude Code

Restores the `wp_register_development_scripts()` function and associated
build infrastructure to enable hot module replacement (HMR) when using
`@wordpress/scripts` with the `--hot` flag.

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 --hot` for block development.

This commit:
- Adds `react-refresh` and `@pmmmwh/react-refresh-webpack-plugin` npm dependencies
- Creates `tools/webpack/development.js` to build the development scripts
- Restores `wp_register_development_scripts()` in `script-loader.php`
- Removes the deprecated stub from `deprecated.php`

The scripts are only registered when `SCRIPT_DEBUG` is true and are not
loaded during Core tests.

Props youknowriad.
Fixes #64393.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props youknowriad.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@youknowriad
Copy link
Contributor Author

Hot reloading has proven to be not very valuable in Gutenberg and WordPress in general since it's not a typical SPA. That said, this PR restores the previous behavior so we can make an informed decision about whether we still want it or not.

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@youknowriad
Copy link
Contributor Author

I tested this with an example plugin, it works but I understand why no one really uses this, it's not the seamless experience that you get with SPAs. Anyone, we can see whether to commit or not this PR.

@youknowriad youknowriad requested a review from t-hamano January 13, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant