Skip to content

Commit

Permalink
Scripts: Fallback to src/index.js when no valid scripts in metadata…
Browse files Browse the repository at this point in the history
… for `build` command (#38367)

* Scripts: Fallback to `src/index.js` when no valid scripts in metadata for `build` command

* Scripts: Add CHANGELOG entry
  • Loading branch information
gziolo committed Jan 31, 2022
1 parent a406895 commit b60dc75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

### Bug Fix

- Fix the `build` command that does not generate assets on Windows OS [#38348](https://github.com/WordPress/gutenberg/pull/38348).
- Fix the `build` command that does not generate assets on Windows OS ([#38348](https://github.com/WordPress/gutenberg/pull/38348)).
- Adds fallback to `src/index.js` when no valid scripts discovered in metadata files when running the `build` command ([#38367](https://github.com/WordPress/gutenberg/pull/38367)).

## 20.0.1 (2022-01-28)

Expand Down
6 changes: 5 additions & 1 deletion packages/scripts/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function getWebpackEntryPoints() {
} );

if ( blockMetadataFiles.length > 0 ) {
return blockMetadataFiles.reduce(
const entryPoints = blockMetadataFiles.reduce(
( accumulator, blockMetadataFile ) => {
const {
editorScript,
Expand Down Expand Up @@ -227,6 +227,10 @@ function getWebpackEntryPoints() {
},
{}
);

if ( Object.keys( entryPoints ).length > 0 ) {
return entryPoints;
}
}

// 3. Checks whether a standard file name can be detected in the `src` directory,
Expand Down

0 comments on commit b60dc75

Please sign in to comment.