Skip to content

Build: Invoke Gutenberg build script directly to fix base-url argument passing#10974

Closed
youknowriad wants to merge 3 commits intoWordPress:trunkfrom
youknowriad:fix-gutenberg-build-arg
Closed

Build: Invoke Gutenberg build script directly to fix base-url argument passing#10974
youknowriad wants to merge 3 commits intoWordPress:trunkfrom
youknowriad:fix-gutenberg-build-arg

Conversation

@youknowriad
Copy link
Contributor

@youknowriad youknowriad commented Feb 18, 2026

Invoke node bin/build.mjs directly instead of going through npm run build --, which forwards arguments through a shell layer that can mangle the --base-url value (containing spaces, parentheses, and single quotes) on some platforms. This may have caused the generated constants.php to be missing the trailing slash in the build_url on certain Linux machines.

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

Use of AI Tools

This PR was co-authored with Claude Code (Claude Opus 4.6).


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

…t passing.

When building Gutenberg via `npm run build -- --base-url=...`, npm forwards arguments through a shell layer, which can mangle the `--base-url` value (containing spaces, parentheses, and single quotes) on some platforms. This caused the generated `constants.php` to be missing the trailing slash in the `build_url`.

Invoke `node bin/build.mjs` directly instead, bypassing npm's shell forwarding entirely. The argument is passed as a single array element via `spawn` with `shell: false`, so it arrives intact regardless of platform.

Props youknowriad.
Fixes #64656.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Feb 18, 2026

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.

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

Props youknowriad, desrosj.

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

…rectly.

When bypassing `npm run build` to call `node bin/build.mjs` directly,
the `node_modules/.bin` directory is not on the PATH. This caused
`wp-build` (used internally by the build script) to fail with ENOENT
on CI.

Follow-up to [60573].

Props youknowriad.
Fixes #64656.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@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

  • 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.

Copy link
Member

@desrosj desrosj left a comment

Choose a reason for hiding this comment

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

I went and tracked down the failure log from when the win32 check was added. Found it here. Including the log output to preserve it after the log expires in GitHub Actions:

Command errors:

❌ Build failed: spawn EINVAL

❌ Build failed: npm run build -- --base-url="includes_url( 'build' )" failed with code 1
Warning: Task "gutenberg-build" failed.� Use --force to continue.

Aborted due to warnings.

I haven't been able to track down exactly what changed in the surrounding code so this is not causing failures now. But it seems safe enough to give a try.

Temporarily dumps the contents of constants.php from both the Gutenberg
build output and the final WordPress build directory to help diagnose
the missing trailing slash issue.

Props youknowriad.
See #64656.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@youknowriad youknowriad deleted the fix-gutenberg-build-arg branch February 19, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants