Build: Invoke Gutenberg build script directly to fix base-url argument passing#10974
Build: Invoke Gutenberg build script directly to fix base-url argument passing#10974youknowriad wants to merge 3 commits intoWordPress:trunkfrom
Conversation
…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>
|
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 Core Committers: Use this line as a base for the props when committing in SVN: 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>
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
desrosj
left a comment
There was a problem hiding this comment.
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>
Invoke
node bin/build.mjsdirectly instead of going throughnpm run build --, which forwards arguments through a shell layer that can mangle the--base-urlvalue (containing spaces, parentheses, and single quotes) on some platforms. This may have caused the generatedconstants.phpto be missing the trailing slash in thebuild_urlon 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.