Skip to content

Scripts: Allow a custom output path for --blocks-manifest - #83876

Open
Mayank-Tripathi32 wants to merge 3 commits into
WordPress:trunkfrom
Mayank-Tripathi32:feat/70694-blocks-manifest-output
Open

Mayank-Tripathi32 wants to merge 3 commits into
WordPress:trunkfrom
Mayank-Tripathi32:feat/70694-blocks-manifest-output

Conversation

@Mayank-Tripathi32

Copy link
Copy Markdown
Member

What?

Closes #70694

wp-scripts build and wp-scripts start now accept a path for --blocks-manifest, e.g. --blocks-manifest=dist/blocks-manifest.php. A bare --blocks-manifest works as before.

Why?

The manifest was always written to blocks-manifest.php in the webpack output folder. Only the standalone build-blocks-manifest command accepted --output, so projects that keep the manifest elsewhere couldn't use the flag with build or start.

How?

  • getWebpackArgs() reads the value of --blocks-manifest=<path> and stores it in WP_BLOCKS_MANIFEST_OUTPUT, next to the existing WP_BLOCKS_MANIFEST.
  • The manifest webpack plugin passes it on to build-blocks-manifest as --output.
  • The path is relative to the current working directory, the same as the standalone command's --output.

I gave the existing flag a value instead of adding a separate --output-blocks-manifest flag (suggested in the issue), so it works like --source-path= and there's one flag to learn.

Testing Instructions

In a block plugin created with @wordpress/create-block:

  1. npx wp-scripts build --blocks-manifest=dist/blocks-manifest.php: the manifest is written to dist/, not build/.
  2. npx wp-scripts start --blocks-manifest=dist/blocks-manifest.php, then edit a block.json: the manifest in dist/ is regenerated.
  3. npx wp-scripts build --blocks-manifest: still writes build/blocks-manifest.php.

Unit tests: npm run test:unit -- packages/scripts/utils/test/index.js

Testing Instructions for Keyboard

No UI changes.

Use of AI Tools

Yes, Opus is used for implementation.

start and build always wrote the manifest to the webpack output folder.
Accept --blocks-manifest=<path> and pass it on as --output. The bare
flag keeps the current behaviour. See WordPress#70694.
@Mayank-Tripathi32 Mayank-Tripathi32 added [Type] Enhancement A suggestion for improvement. [Tool] WP Scripts /packages/scripts labels Sep 30, 2026
@Mayank-Tripathi32
Mayank-Tripathi32 marked this pull request as ready for review September 30, 2026 12:40
@github-actions

Copy link
Copy Markdown

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.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Mayank-Tripathi32 <mayanktripathi32@git.wordpress.org>

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

This branch has not been deployed

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

Labels

[Tool] WP Scripts /packages/scripts [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"--blocks-manifest" allow specific path

1 participant