Changeset 53140 for trunk/src/wp-includes/script-loader.php
- Timestamp:
- 04/11/2022 04:08:12 PM (4 years 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
r53124 r53140 213 213 214 214 return $polyfill; 215 } 216 217 /** 218 * Registers development scripts that integrate with `@wordpress/scripts`. 219 * 220 * @see https://github.com/WordPress/gutenberg/tree/trunk/packages/scripts#start 221 * 222 * @since 6.0.0 223 * 224 * @param WP_Scripts $scripts WP_Scripts object. 225 */ 226 function wp_register_development_scripts( $scripts ) { 227 if ( 228 ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG 229 || empty( $scripts->registered['react'] ) 230 ) { 231 return; 232 } 233 234 $development_scripts = array( 235 'react-refresh-entry', 236 'react-refresh-runtime', 237 ); 238 239 foreach ( $development_scripts as $script_name ) { 240 $assets = include ABSPATH . WPINC . '/assets/script-loader-' . $script_name . '.php'; 241 if ( ! is_array( $assets ) ) { 242 return; 243 } 244 $scripts->add( 245 'wp-' . $script_name, 246 '/wp-includes/js/dist/development/' . $script_name . '.js', 247 $assets['dependencies'], 248 $assets['version'] 249 ); 250 } 251 252 // See https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/docs/TROUBLESHOOTING.md#externalising-react. 253 $scripts->registered['react']->deps[] = 'wp-react-refresh-entry'; 215 254 } 216 255 … … 561 600 function wp_default_packages( $scripts ) { 562 601 wp_default_packages_vendor( $scripts ); 602 wp_register_development_scripts( $scripts ); 563 603 wp_register_tinymce_scripts( $scripts ); 564 604 wp_default_packages_scripts( $scripts );
Note: See TracChangeset
for help on using the changeset viewer.