Skip to content

Fix Gutenberg JSX runtime dependency loading - #32

Open
Jan-CoreBunch wants to merge 1 commit into
CoreBunch:mainfrom
Jan-CoreBunch:fix/gutenberg-jsx-runtime-dependency
Open

Fix Gutenberg JSX runtime dependency loading#32
Jan-CoreBunch wants to merge 1 commit into
CoreBunch:mainfrom
Jan-CoreBunch:fix/gutenberg-jsx-runtime-dependency

Conversation

@Jan-CoreBunch

Copy link
Copy Markdown
Contributor

What

  • Fix the Gutenberg editor white screen caused by loading the Core Framework bundle without its generated WordPress dependencies.
  • Load gutenberg/index.asset.php and use its dependency list and content-hash version, with a complete fallback if the manifest is unavailable.
  • Declare WordPress 6.6 as the minimum for Core Framework 2.x in the plugin header, WordPress readme, and development documentation.
  • Document the fix and compatibility change in the changelog.

Why

The Gutenberg bundle is built with the new JSX transform and calls window.ReactJSXRuntime.jsx. Its generated asset manifest correctly includes react-jsx-runtime, but the PHP enqueue code ignored that manifest and used an older hard-coded dependency list. When the runtime was unavailable, rendering the Core Framework block wrapper threw a fatal React error and left the editor blank.

WordPress introduced the JSX runtime in 6.6, so Core Framework 2.x now declares 6.6 as its minimum instead of claiming compatibility with WordPress 6.0–6.5.

Verification

Automated checks:

php -l wp/App/Gutenberg/Functions.php
php -l core-framework.php
# No syntax errors

vendor/bin/phpcs wp/App/Gutenberg/Functions.php --standard=phpcs.ruleset.xml
# Passed

vendor/bin/phpunit --do-not-cache-result Tests
# OK (36 tests, 68 assertions)

Manual test using the latest WordPress with Twenty Twenty-Four:

  • The post editor opens normally with the Core Framework Gutenberg integration enabled.
  • Core Framework variables and classes can be added and removed successfully.
  • typeof window.ReactJSXRuntime?.jsx returns "function".
  • The Gutenberg bundle loads with the asset-manifest version 22d01165d701dd03054a.
  • No Core Framework console errors occur.

The remaining global-styles-css-custom-properties-inline-css iframe warning is an upstream Gutenberg false positive tracked in WordPress/gutenberg#76082.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant