Compile blocks under assets/build/blocks/#707
Open
pratik-londhe4 wants to merge 8 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the theme’s build pipeline so block sources under src/blocks/ are compiled into assets/build/blocks/, and prevents @wordpress/scripts’ inherited copy behavior from duplicating block files into the JS build output.
Changes:
- Add a dedicated
build:blocksscript and fanbuild:dev/build:prodout into*:js+build:blocks. - Filter out the inherited
CopyPluginfrom the theme’s extended webpack config to avoid copying block files intoassets/build/js/blocks/. - Update the npm lockfile to reflect dependency graph changes.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| webpack.config.js | Filters inherited webpack plugins to remove the wp-scripts CopyPlugin and avoid redundant block file copying into the JS output dir. |
| package.json | Introduces build:blocks and restructures build scripts to run both JS and block builds. |
| package-lock.json | Updates lockfile dependency metadata (currently inconsistent with package.json). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aryanjasala
reviewed
Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Block source files under
src/blocks/weren't being compiled by the theme's build. This PR adds a dedicated build step that compiles them toassets/build/blocks/, matching the pattern infeatures-plugin-skeleton.Technical Details
The theme's custom
webpack.config.jsonly declares entries forsrc/css/andsrc/js/{frontend,admin,editor}/—src/blocks/was not in any entry list. The reason blocks appeared to be built was that wp-scripts' inheritedCopyPluginwas silently copyingblock.json/render.phpfromsrc/blocks/intoassets/build/js/blocks/. Noedit.js/view.js/index.jswere being compiled, and no*.asset.phpwas being emitted alongside.The fix mirrors the plugin skeleton:
Checklist
build:blocksnpm script using wp-scripts' default config +--webpack-src-dir/--output-pathbuild:devandbuild:prodto fan out to*:js+:blocksCopyPluginout of inherited webpack plugins to stop duplicating block files intoassets/build/js/blocks/assets/build/blocks/example-block-*/assets/build/js/blocks/no longer exists after a clean buildScreenshots
To-do
Fixes/Covers issue
Fixes #