Skip to content

Commit

Permalink
Add script dependencies undetectable by build tools
Browse files Browse the repository at this point in the history
Some scripts have dependencies that are undetectable by the webpack
plugin used to generate the dependency files. Add these dependencies
to the generated dependencies.
  • Loading branch information
sirreal committed Apr 24, 2019
1 parent ba7bfc0 commit 1fd8613
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,17 @@ function gutenberg_register_packages_scripts() {
? json_decode( file_get_contents( $dependencies_file ) )
: array();

// Add dependencies that cannot be detected and generated by build tools.
switch ( $handle ) {
case 'wp-block-library':
array_push( $dependencies, 'editor' );
break;

case 'wp-edit-post':
array_push( $dependencies, 'media-models', 'media-views', 'postbox' );
break;
}

// Get the path from Gutenberg directory as expected by `gutenberg_url`.
$gutenberg_path = substr( $path, strlen( gutenberg_dir_path() ) );

Expand Down

0 comments on commit 1fd8613

Please sign in to comment.