Skip to content

Conversation

@youknowriad
Copy link
Contributor

@youknowriad youknowriad commented Dec 16, 2025

Trac ticket: https://core.trac.wordpress.org/ticket/64393

Summary

This PR changes WordPress Core's Gutenberg integration from npm packages to a checkout-and-build approach. Instead of syncing individual npm packages, Core now checks out the Gutenberg repository, builds it, and copies the build artifacts. This enables Core to use Gutenberg's advanced features like route-based navigation, full-page rendering, and the new Font Library. But also offers us the possibility to streamline more backports later (an example in this PR is the automatic copy of theme.json file). Check the issue for more details on the problem at hand.

New Build Pipeline

  1. Checkout: npm run gutenberg:checkout clones Gutenberg at a specified ref
  2. Build: npm run gutenberg:build runs Gutenberg's build process
  3. Copy: npm run gutenberg:copy copies and transforms build output to Core
  4. Integrate: npm run gutenberg:integrate runs all three steps

What Gets Copied

From Gutenberg build to Core:

  • /build/routes//src/wp-includes/build/routes/
  • /build/pages//src/wp-includes/build/pages/
  • /build/modules//src/wp-includes/js/dist/script-modules/
  • /build/scripts//src/wp-includes/js/dist/
  • /build/styles//src/wp-includes/css/dist/
  • /build/blocks//src/wp-includes/blocks/

Path Transformations

The copy script transforms Gutenberg plugin paths to Core paths:

  • plugins_url()includes_url()
  • plugin_dir_path()ABSPATH . WPINC . '/build/'
  • Boot module paths adjusted for Core's directory structure
  • Enqueue conditions work with both menu pages and direct file access

Ideally these transformations shouldn't be needed, maybe we can make our "build" tool more generic to streamline the integration better and allow "building for core" directly. I'll look into that separately.

Webpack Changes

Removed webpack configs that are now replaced by Gutenberg's build:

  • tools/webpack/blocks.js - Using Gutenberg's block builds
  • tools/webpack/packages.js - Using Gutenberg's script builds
  • tools/webpack/script-modules.js - Using Gutenberg's module builds
  • tools/webpack/development.js - Using Gutenberg's dev builds
  • tools/webpack/vendors.js - Using Gutenberg's vendors
  • tools/webpack/media.js - Kept (Core-specific files). to be honest, I'm not really sure if Webpack is needed for these files but I kept it unchanged for now, we could decide to remove the webpack dependency later entirely.

Font Library Integration

Added /wp-admin/font-library.php as the first proof-of-concept using this new architecture.

Some other changes.

src/wp-includes/script-modules.php

  • Removed outdated debug version handling for @wordpress/interactivity (this has been removed from Gutenberg)

Gruntfile.js

  • Added a vendor copy step that was previously done in webpack/packages.js

package.json

  • The "hash" or Gutenberg version used is defined here. Right now I picked a recent Gutenberg commit but this is likely to refer commits in wp/* release branches in Gutenberg.

Testing

  • There should be no big disruptions in the core development workflow. I tried to keep the flow the same, the output files in the same places...
  • The initial build might be slow because of typescript building, the next ones should be ok.

I think there are a lot of simplifications we could do later (specially to the copy script) by aligning the folder structures more closely together (the build folder of Gutenberg, and the file structure for built scripts, styles, modules, pages... on Core). It does require changing some paths on Core. I do think it would be for the better but I kept it out of this PR.

@youknowriad youknowriad self-assigned this Dec 16, 2025
@github-actions
Copy link

github-actions bot commented Dec 16, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @1178653+wordpress-develop-pr-bot[bot]@users.noreply.github.com.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

Core Committers: Use this line as a base for the props when committing in SVN:

Props youknowriad, jonsurrell, ellatrix, westonruter, desrosj, isabel_brison.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@youknowriad
Copy link
Contributor Author

Looks like there's an infinite loop because wp-build use time based hashes which triggers the "commit unsaved changes" on each commit. I'm going to disable that workflow temporarily.

@youknowriad youknowriad force-pushed the update/gutenberg-integration branch 7 times, most recently from d03d49e to cd57438 Compare December 16, 2025 13:46
@ellatrix
Copy link
Member

This is exciting! Also paves the way to run Gutenberg e2e tests :)

@youknowriad
Copy link
Contributor Author

What I like about this process is that it actually clarifies what it takes to "integrate Gutenberg into Core" it all happens in a single command. While previously it was scattered all over the place.

@youknowriad youknowriad force-pushed the update/gutenberg-integration branch 3 times, most recently from bd0eee2 to cd9bf2c Compare December 17, 2025 12:46
@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@youknowriad youknowriad force-pushed the update/gutenberg-integration branch from cd9bf2c to eff7b55 Compare December 17, 2025 13:54
@youknowriad
Copy link
Contributor Author

Ok I think this is ready to land personally. I'd love reviews though :)

/src/wp-includes/class-wp-block-parser-block.php
/src/wp-includes/class-wp-block-parser-frame.php
/src/wp-includes/theme.json
/src/wp-includes/theme-i18n.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we need to manually add this to svnignore too


env:
PUPPETEER_SKIP_DOWNLOAD: ${{ true }}
NODE_OPTIONS: --max-old-space-size=4096
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typescript building on MacOS consumes more memory than the default allocated memory to node processes. I recall we had to do something similar elsewhere. (Without it the build fails on MacOS on CI)

@youknowriad youknowriad force-pushed the update/gutenberg-integration branch from ce9e365 to 0ef1698 Compare January 5, 2026 08:22
  Lower options_count threshold from 100 to 1 to avoid intermittent
  failures caused by InnoDB's TABLE_ROWS estimate fluctuations.
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 61438
GitHub commit: 22294af

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions bot closed this Jan 5, 2026
@youknowriad youknowriad deleted the update/gutenberg-integration branch January 5, 2026 10:52
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.

6 participants