Framework: Specify missing wp-url dependencies #8362
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related: #8300
This pull request seeks to resolve an issue where the Archives block produces an error. This was caused by #8300, where new dependencies were introduced on the
@wordpress/url
module, but not specified inclient-assets.php
. The changes here add this dependency towp-core-blocks
andwp-components
script handles. While I was here, I also re-alphabetized the dependency list for these handles (and forwp-editor
, which was touched in #8300 but already definedwp-url
as a dependency).In the future, we might consider how to automate or validate this process, so that it's not manually curated. I had taken an attempt here, first with a plain PHP script, then with a custom PHPCS Sniff. Ultimately,
gutenberg_register_scripts_and_styles
touches many core functions which need to be defined, meaning that it's most likely needed to load most of the WordPress context to do programatically. Another alternative is to run validate at runtime (at least inSCRIPT_DEBUG
) to check that, for any package defined inpackages/
, its corresponding script registration includes all the same dependencies as listed in itspackage.json
dependencies
object.Testing instructions: