Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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