Ticket #48154: script-loader.php.patch
File script-loader.php.patch, 1.4 KB (added by , 5 years ago) |
---|
-
src/wp-includes/script-loader.php
287 287 288 288 foreach ( $packages as $package ) { 289 289 $handle = 'wp-' . $package; 290 $path = "/wp-includes/js/dist/$package$suffix.js"; 290 $path = WPINC . '/js/dist/$package$suffix.js'; 291 $php_support_file_path = ABSPATH . WPINC . '/assets/dist/$package$suffix.asset.php'; 291 292 292 if ( ! file_exists( ABSPATH . $path ) ){293 continue;293 if( ! file_exists( $php_support_file_path ) ){ 294 wp_die(__('You need to run "npm build:dev" for this site to create the assets/dist files' ) ); 294 295 } 295 296 296 $asset_file = include ABSPATH . WPINC . "/assets/dist/$package$suffix.asset.php";297 $asset_file = include $php_support_file_path; 297 298 $dependencies = $asset_file['dependencies']; 299 $version = $asset_file['version']; 298 300 299 301 // Add dependencies that cannot be detected and generated by build tools. 300 302 switch ( $handle ) { … … 305 307 array_push( $dependencies, 'media-models', 'media-views', 'postbox', 'wp-dom-ready' ); 306 308 break; 307 309 } 310 $scripts->add( $handle, $path, $dependencies, $version, 1 ); 308 311 309 $scripts->add( $handle, $path, $dependencies, $asset_file['version'], 1 );310 311 312 if ( in_array( $package, $package_translations, true ) ) { 312 313 $scripts->set_translations( $handle ); 313 314 }