Build Tools: do not include assets for JS dependencies that do not exist.

This is a follow-up for #48154, where we started including *.asset.php files to declare package dependencies.
This works well but creates warnings in environments where the package does not exist because WordPress was not fully built.

Props jeherve, swissspidy.

Fixes #49144.



git-svn-id: https://develop.svn.wordpress.org/trunk@47048 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Grzegorz (Greg) Ziółkowski 2020-01-07 15:26:44 +00:00
parent 638a948719
commit 01a3632b15
1 changed files with 8 additions and 3 deletions

View File

@ -285,9 +285,14 @@ function wp_default_packages_scripts( &$scripts ) {
); );
foreach ( $packages as $package ) { foreach ( $packages as $package ) {
$handle = 'wp-' . $package; $handle = 'wp-' . $package;
$path = "/wp-includes/js/dist/$package$suffix.js"; $path = "/wp-includes/js/dist/$package$suffix.js";
$asset_file = include( ABSPATH . WPINC . "/assets/dist/$package$suffix.asset.php" );
if ( ! file_exists( ABSPATH . $path ) ) {
continue;
}
$asset_file = include ABSPATH . WPINC . "/assets/dist/$package$suffix.asset.php";
$dependencies = $asset_file['dependencies']; $dependencies = $asset_file['dependencies'];
// Add dependencies that cannot be detected and generated by build tools. // Add dependencies that cannot be detected and generated by build tools.