Skip to content

wp-build: stop writing worker-code.ts into src/ during build#76118

Closed
ramonjd wants to merge 3 commits into
trunkfrom
try/build-worker-code
Closed

wp-build: stop writing worker-code.ts into src/ during build#76118
ramonjd wants to merge 3 commits into
trunkfrom
try/build-worker-code

Conversation

@ramonjd

@ramonjd ramonjd commented Mar 4, 2026

Copy link
Copy Markdown
Member

Warning

This is just a test to see if the build works.

The vips build was writing the bundled worker content into src/worker-code.ts, which the file watcher detected as a source change and triggered an infinite rebuild loop.

Instead, write build-module/worker-code.mjs directly after the worker bundle is built, and add a createWorkerCodeExternalPlugin that short-circuits esbuild's filesystem resolution of ./worker-code imports during transpilation. A committed worker-code.d.ts stub in src/ satisfies TypeScript without any generated file touching the watched directory.

What?

Closes

Why?

How?

Testing Instructions

Testing Instructions for Keyboard

Screenshots or screencast

Before After

@github-actions

github-actions Bot commented Mar 4, 2026

Copy link
Copy Markdown

Size Change: -10 B (0%)

Total Size: 7.73 MB

📦 View Changed
Filename Size Change
build/modules/vips/worker.min.js 3.69 MB -10 B (0%)

compressed-size-action

@github-actions

github-actions Bot commented Mar 4, 2026

Copy link
Copy Markdown

Flaky tests detected in 31297b9.
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/22654488865
📝 Reported issues:

@ramonjd ramonjd closed this Mar 10, 2026
@ramonjd
ramonjd deleted the try/build-worker-code branch March 10, 2026 06:40
@ramonjd
ramonjd restored the try/build-worker-code branch July 18, 2026 00:49
@ramonjd ramonjd reopened this Jul 18, 2026
ramonjd added 3 commits July 18, 2026 10:54
The vips build was writing the bundled worker content into
src/worker-code.ts, which the file watcher detected as a source
change and triggered an infinite rebuild loop.

Instead, write build-module/worker-code.mjs directly after the worker
bundle is built, and add a createWorkerCodeExternalPlugin that
short-circuits esbuild's filesystem resolution of ./worker-code imports
during transpilation. A committed worker-code.d.ts stub in src/ satisfies
TypeScript without any generated file touching the watched directory.
Add the src/worker-code.d.ts type stub to @wordpress/video-conversion,
which adopted the wpWorkers pipeline after this branch was written.

Remove the tools/build-scripts worker placeholder generation step: the
committed type stubs satisfy TypeScript directly, so nothing needs to
write worker-code.ts into src/ anymore.
@ramonjd
ramonjd force-pushed the try/build-worker-code branch from 31297b9 to aa7d710 Compare July 18, 2026 01:21
@ramonjd

ramonjd commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

Fixed in #80361 (comment)

@ramonjd ramonjd closed this Jul 23, 2026
@ramonjd
ramonjd deleted the try/build-worker-code branch July 23, 2026 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant