Skip to content

Build: Only generate asset file once and keep version consistent#74051

Merged
youknowriad merged 1 commit intotrunkfrom
update/only-generate-asset-file-once
Dec 16, 2025
Merged

Build: Only generate asset file once and keep version consistent#74051
youknowriad merged 1 commit intotrunkfrom
update/only-generate-asset-file-once

Conversation

@youknowriad
Copy link
Copy Markdown
Contributor

Related WordPress/wordpress-develop#10638

Problem

Both minified and non-minified builds were generating the same .asset.php file concurrently, causing a race condition. The hash would alternate between two values depending on which build finished last:

  • Minified build: hash of index.min.js + index.min.js.map
  • Non-minified build: hash of index.js + index.js.map

This made builds non-deterministic, causing unnecessary git diffs on every rebuild.

Solution

  • Added generateAssetFile parameter to wordpressExternalsPlugin() (defaults to true)
  • Only the minified build now generates the .asset.php file
  • Non-minified build skips asset file generation entirely

This ensures each .asset.php file is written exactly once with a consistent hash.

Testing

Verified multiple consecutive builds produce identical .asset.php files with stable hashes.

@youknowriad youknowriad self-assigned this Dec 16, 2025
@youknowriad youknowriad added the [Type] Build Tooling Issues or PRs related to build tooling label Dec 16, 2025
@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: youknowriad <youknowriad@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@youknowriad youknowriad force-pushed the update/only-generate-asset-file-once branch from ecdaa5b to 02d2380 Compare December 16, 2025 16:54
@youknowriad youknowriad force-pushed the update/only-generate-asset-file-once branch from 02d2380 to 10cb4cc Compare December 16, 2025 17:16
@youknowriad youknowriad merged commit 4801c4a into trunk Dec 16, 2025
34 checks passed
@youknowriad youknowriad deleted the update/only-generate-asset-file-once branch December 16, 2025 17:43
@github-actions github-actions Bot added this to the Gutenberg 22.4 milestone Dec 16, 2025
@github-actions
Copy link
Copy Markdown

Flaky tests detected in 10cb4cc.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/20276620816
📝 Reported issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant