mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-06 13:44:30 +00:00
Build: Improve how combined assets are generated
Allows to revert changes applied in [54277] - temporary workaround for the failing Test NPM CI check on Windows. Improvements included: - generate combined asset files for both production and development - store in the repository only the production version of the combined assets for packages, we use everything else only in development - to make unit tests work, ensure that they ignore react fast refresh and use the production version of combined assets that are present in the source code Props bernhard-reiter, jsnajdr, clorith, wildworks. Fixes #56615. git-svn-id: https://develop.svn.wordpress.org/trunk@54289 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -227,6 +227,7 @@ function wp_register_development_scripts( $scripts ) {
|
||||
if (
|
||||
! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG
|
||||
|| empty( $scripts->registered['react'] )
|
||||
|| defined( 'WP_RUN_CORE_TESTS' )
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -264,8 +265,7 @@ function wp_register_development_scripts( $scripts ) {
|
||||
* @param WP_Scripts $scripts WP_Scripts object.
|
||||
*/
|
||||
function wp_default_packages_scripts( $scripts ) {
|
||||
$suffix = wp_scripts_get_suffix();
|
||||
|
||||
$suffix = defined( 'WP_RUN_CORE_TESTS' ) ? '.min' : wp_scripts_get_suffix();
|
||||
/*
|
||||
* Expects multidimensional array like:
|
||||
*
|
||||
@@ -273,10 +273,10 @@ function wp_default_packages_scripts( $scripts ) {
|
||||
* 'annotations.js' => array('dependencies' => array(...), 'version' => '...'),
|
||||
* 'api-fetch.js' => array(...
|
||||
*/
|
||||
$assets = include ABSPATH . WPINC . '/assets/script-loader-packages.php';
|
||||
$assets = include ABSPATH . WPINC . "/assets/script-loader-packages{$suffix}.php";
|
||||
|
||||
foreach ( $assets as $package_name => $package_data ) {
|
||||
$basename = basename( $package_name, '.js' );
|
||||
foreach ( $assets as $file_name => $package_data ) {
|
||||
$basename = str_replace( $suffix . '.js', '', basename( $file_name ) );
|
||||
$handle = 'wp-' . $basename;
|
||||
$path = "/wp-includes/js/dist/{$basename}{$suffix}.js";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user