wp-build: try without including private APIs#75460
Conversation
|
Size Change: -23 B (0%) Total Size: 3.02 MB
ℹ️ View Unchanged
|
5cb438f to
3cad846
Compare
| add_action( 'wp_default_scripts', '{{PREFIX}}_register_package_scripts' ); | ||
| // Priority 9 so that the Gutenberg plugin (priority 10) can override | ||
| // these scripts with newer versions when it is active. | ||
| add_action( 'wp_default_scripts', '{{PREFIX}}_register_package_scripts', 9 ); |
There was a problem hiding this comment.
I wonder if this means Gutenberg won't override Core anymore?
There was a problem hiding this comment.
In which case?
- GB active:
wp_default_scriptsat 10 in GB will override this ones, which is what fixes the problem? - GB not active: wp-build scripts are active?
There was a problem hiding this comment.
GB active: wp_default_scripts at 10 in GB will override this ones, which is what fixes the problem?
Gutenberg runs this template as well. So I thought gutenberg will also get 9 after this PR is merged.
There was a problem hiding this comment.
Oh, for what does GB use this? Don't we only use client-assets.php?
There was a problem hiding this comment.
client-assets is only for things that are not "refutal scripts or modules", overrides on top of it. Nowadays Gutenberg is almost full wp-build for its own scripts and modules.
There was a problem hiding this comment.
I see. So could we check if we're in the GB plugin or not?
There was a problem hiding this comment.
I mean if there's no other way sure but I wonder if we can find a generic way to make this work.
- Gutenberg should override Core
- Plugins should not override Gutenberg, they can override Core too
|
This explains a lot! We've seen all sorts of weird issues (styling, JS scripts misbehaving). Our problem is that with the latest released version of Gutenberg, WP Build pages don't load due to missing scripts. Then, with Gutenberg We got close to seeing where there the problem might be but not exactly how everything interplays: https://github.com/Automattic/jetpack/pull/47035/changes (this is just a temporary fix to get things unblocked for development). |
|
Changing the relative priorities works. I have a draft here based on this PR that fixes it, though it adds a new value to Gutenberg's package.json and would require a new release of wp-build, so you'll probably have a more elegant fix in mind. |
What?
Make sure wp-build's private-apis script doesn't override Gutenberg's
Why?
See #75440.
How?
Move to priority 9, before GB scripts are added.
Testing Instructions
I'm testing by rebuilding https://github.com/dhasilva/minimal-wp-build-test/tree/trunk and trying http://localhost:8888/wp-admin/tools.php?page=minimal-wp-build-test-wp-admin without GB and with GB. There seems to be an unrelated error when GB is not active.
Testing Instructions for Keyboard
Screenshots or screencast