diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index 9b863bd17f7bd..b31861ddfc5b4 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -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) diff --git a/packages/scripts/utils/config.js b/packages/scripts/utils/config.js index 8ec4d538fafcc..c61cfbcb6fef5 100644 --- a/packages/scripts/utils/config.js +++ b/packages/scripts/utils/config.js @@ -188,7 +188,7 @@ function getWebpackEntryPoints() { } ); if ( blockMetadataFiles.length > 0 ) { - return blockMetadataFiles.reduce( + const entryPoints = blockMetadataFiles.reduce( ( accumulator, blockMetadataFile ) => { const { editorScript, @@ -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,