Changeset 61487 for trunk/src/wp-includes/script-loader.php
- Timestamp:
- 01/15/2026 12:55:21 PM (4 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/script-loader.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/script-loader.php
r61485 r61487 164 164 'after' 165 165 ); 166 } 167 168 /** 169 * Registers development scripts that integrate with `@wordpress/scripts`. 170 * 171 * These scripts enable hot module replacement (HMR) for block development 172 * when using `wp-scripts start --hot`. 173 * 174 * @see https://github.com/WordPress/gutenberg/tree/trunk/packages/scripts#start 175 * 176 * @since 6.0.0 177 * 178 * @param WP_Scripts $scripts WP_Scripts object. 179 */ 180 function wp_register_development_scripts( $scripts ) { 181 if ( 182 ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG 183 || empty( $scripts->registered['react'] ) 184 || defined( 'WP_RUN_CORE_TESTS' ) 185 ) { 186 return; 187 } 188 189 // React Refresh runtime - exposes ReactRefreshRuntime global. 190 // No dependencies. 191 $scripts->add( 192 'wp-react-refresh-runtime', 193 '/wp-includes/js/dist/development/react-refresh-runtime.js', 194 array(), 195 '0.14.0' 196 ); 197 198 // React Refresh entry - injects runtime into global hook. 199 // Must load before React to set up hooks. 200 $scripts->add( 201 'wp-react-refresh-entry', 202 '/wp-includes/js/dist/development/react-refresh-entry.js', 203 array( 'wp-react-refresh-runtime' ), 204 '0.14.0' 205 ); 206 207 // Add entry as a dependency of React so it loads first. 208 // See https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/docs/TROUBLESHOOTING.md#externalising-react. 209 $scripts->registered['react']->deps[] = 'wp-react-refresh-entry'; 166 210 } 167 211 … … 619 663 function wp_default_packages( $scripts ) { 620 664 wp_default_packages_vendor( $scripts ); 665 wp_register_development_scripts( $scripts ); 621 666 wp_register_tinymce_scripts( $scripts ); 622 667 wp_default_packages_scripts( $scripts );
Note: See TracChangeset
for help on using the changeset viewer.