wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_register_development_scripts › WordPress Function
Seit6.0.0
Veraltetn/v
› wp_register_development_scripts ( $scripts )
Parameter: |
|
Siehe: | |
Definiert in: |
|
Codex: |
Registers development scripts that integrate with `@wordpress/scripts`.
Ähnliche Funktionen: wp_register_script, wp_register_tinymce_scripts, wp_deregister_script, wp_register_alignment_support, wp_is_development_mode
Quellcode
function wp_register_development_scripts( $scripts ) { if ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG || empty( $scripts->registered['react'] ) || defined( 'WP_RUN_CORE_TESTS' ) ) { return; } $development_scripts = array( 'react-refresh-entry', 'react-refresh-runtime', ); foreach ( $development_scripts as $script_name ) { $assets = include ABSPATH . WPINC . '/assets/script-loader-' . $script_name . '.php'; if ( ! is_array( $assets ) ) { return; } $scripts->add( 'wp-' . $script_name, '/wp-includes/js/dist/development/' . $script_name . '.js', $assets['dependencies'], $assets['version'] ); } // See https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/docs/TROUBLESHOOTING.md#externalising-react. $scripts->registered['react']->deps[] = 'wp-react-refresh-entry'; }