From 5e04625a2c958abac7fa3b18a9f731321cb917be Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Mon, 31 Jan 2022 09:58:32 +0100 Subject: [PATCH 1/2] Scripts: Fallback to `src/index.js` when no valid scripts in metadata for `build` command --- packages/scripts/utils/config.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/scripts/utils/config.js b/packages/scripts/utils/config.js index 8ec4d538fafccb..c61cfbcb6fef5a 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, From 728e0eef99975501665754570756ae47cd28d2dc Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Mon, 31 Jan 2022 10:19:45 +0100 Subject: [PATCH 2/2] Scripts: Add CHANGELOG entry --- packages/scripts/CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index 9b863bd17f7bd4..b31861ddfc5b41 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)