Skip to content

Build: Skip non-minified build for WASM-inlined workers#76615

Merged
ramonjd merged 1 commit intoWordPress:trunkfrom
adamsilverstein:fix/build-size
Mar 19, 2026
Merged

Build: Skip non-minified build for WASM-inlined workers#76615
ramonjd merged 1 commit intoWordPress:trunkfrom
adamsilverstein:fix/build-size

Conversation

@adamsilverstein
Copy link
Copy Markdown
Member

@adamsilverstein adamsilverstein commented Mar 18, 2026

Summary

Skips generating the non-minified .js version for script module exports that correspond to wpWorkers entries (currently only @wordpress/vips/worker).

Why

The vips worker bundles ~16 MB of base64-encoded WASM data. Minification has negligible effect on this content, so worker.js and worker.min.js are nearly identical in size. The non-minified version provides zero debugging value since the content is all inlined binary WASM data.

Size impact

Before After Saved
Build output (build/modules/vips/) 64 MB (worker.js + worker.min.js + maps) 32 MB (worker.min.js + map only) ~32 MB (50%)
worker.min.js (shipped file) 16.1 MB 16.1 MB (unchanged) 0

This PR reduces the build output by eliminating redundant files. The shipped worker.min.js size is unchanged.

Related PRs for further size reduction

Test plan

  • Run npm run build — verify build/modules/vips/ contains only worker.min.js, worker.min.js.map, and worker.min.asset.php (no worker.js or worker.js.map)
  • Verify build/modules/vips/loader.js (non-worker module) still gets both minified and non-minified versions
  • Test image upload/processing in the editor to confirm vips still works correctly

🤖 Generated with Claude Code

The vips worker bundles ~16MB of base64-encoded WASM data.
Minification has negligible effect on this content, so both
worker.js and worker.min.js are nearly identical in size.
The non-minified version provides no debugging value.

This skips generating the non-minified version for script
module exports that correspond to wpWorkers entries, saving
~32MB (worker.js + worker.js.map) from the build output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 18, 2026

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: adamsilverstein <adamsilverstein@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: adamziel <zieladam@git.wordpress.org>

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

@ramonjd
Copy link
Copy Markdown
Member

ramonjd commented Mar 18, 2026

I checked the build artifact at https://github.com/WordPress/gutenberg/actions/runs/23229363447/job/67519295753?pr=76615

and also a fresh build locally and here's what I'm seeing:

total 66008
drwxr-xr-x  10 rj staff       320 Mar 18 17:01 .
drwxr-xr-x  18 rj staff       576 Mar 18 17:01 ..
-rw-r--r--   1 rj  staff       173 Mar 18 17:01 loader.js
-rw-r--r--   1 rj staff       999 Mar 18 17:01 loader.js.map
-rw-r--r--   1 rj  staff       179 Mar 18 17:01 loader.min.asset.php
-rw-r--r--   1 rj  staff       114 Mar 18 17:01 loader.min.js
-rw-r--r--   1 rj  staff      1006 Mar 18 17:01 loader.min.js.map
-rw-r--r--   1 rj  staff        83 Mar 18 17:01 worker.min.asset.php
-rw-r--r--   1 rj  staff  16859314 Mar 18 17:01 worker.min.js
-rw-r--r--   1 rj  staff  16907864 Mar 18 17:01 worker.min.js.map
du -ch build/modules/vips/* | tail -1

 32M    total

And in trunk

total 131976
drwxr-xr-x  12 rj  staff       384 Mar 18 17:15 .
drwxr-xr-x  18 rj  staff       576 Mar 18 17:15 ..
-rw-r--r--   1 rj  staff       173 Mar 18 17:15 loader.js
-rw-r--r--   1 rj  staff       999 Mar 18 17:15 loader.js.map
-rw-r--r--   1 rj  staff       179 Mar 18 17:15 loader.min.asset.php
-rw-r--r--   1 rj  staff       114 Mar 18 17:15 loader.min.js
-rw-r--r--   1 rj  staff      1006 Mar 18 17:15 loader.min.js.map
-rw-r--r--   1 rj  staff  16867961 Mar 18 17:15 worker.js
-rw-r--r--   1 rj  staff  16902362 Mar 18 17:15 worker.js.map
-rw-r--r--   1 rj  staff        83 Mar 18 17:15 worker.min.asset.php
-rw-r--r--   1 rj  staff  16859314 Mar 18 17:15 worker.min.js
-rw-r--r--   1 rj  staff  16907864 Mar 18 17:15 worker.min.js.map

du -ch build/modules/vips/* | tail -1

 64M    total

👍🏻

@ramonjd ramonjd added [Type] Enhancement A suggestion for improvement. [Feature] Client Side Media Media processing in the browser with WASM [Package] wp-build /packages/wp-build [Type] Build Tooling Issues or PRs related to build tooling and removed [Type] Enhancement A suggestion for improvement. labels Mar 18, 2026
const entryPoint = path.join( packageDir, exportPath );
const baseFileName = path.basename( fileName );

// Skip non-minified build for WASM-inlined workers (e.g., vips).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing to do here, but makes we wonder if packages could support something like skipNonMinified in package.json, e.g.,

	"wpWorkers": {
		"./worker": {
			"entry": "./src/worker.ts",
			"resolve": {
				"vips-es6.js": "vips.js"
			},
            "skipNonMinified": true
		}
	},
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea - we can make this more generic so other packages could opt in to the behavior, lets do that the next time we have a package that wants it.

Copy link
Copy Markdown
Member

@ramonjd ramonjd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me, but it'd be good to get 👀 from folks over on the main issue: #74333 (comment)

@adamziel
Copy link
Copy Markdown
Contributor

LGTM, thank you for addressing this so quickly @adamsilverstein!

@adamsilverstein
Copy link
Copy Markdown
Member Author

LGTM, thank you for addressing this so quickly @adamsilverstein!

You are welcome, I realize time is tight!

Also - this was a regression - we had fixed this previously (I thought anyway!) so I wanted to fix that!

@adamsilverstein adamsilverstein added the Backport to WP 7.0 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Mar 18, 2026
@ramonjd ramonjd merged commit 6345900 into WordPress:trunk Mar 19, 2026
65 of 67 checks passed
@github-actions github-actions bot added this to the Gutenberg 22.9 milestone Mar 19, 2026
@github-actions github-actions bot removed the Backport to WP 7.0 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Mar 19, 2026
gutenbergplugin pushed a commit that referenced this pull request Mar 19, 2026
Co-authored-by: adamsilverstein <adamsilverstein@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: adamziel <zieladam@git.wordpress.org>
@github-actions github-actions bot added the Backported to WP Core Pull request that has been successfully merged into WP Core label Mar 19, 2026
@github-actions
Copy link
Copy Markdown

I just cherry-picked this PR to the wp/7.0 branch to get it included in the next release: 1994d35

@ramonjd
Copy link
Copy Markdown
Member

ramonjd commented Mar 19, 2026

I think this fix is related to this PR:

From what I gather, WASM workers (e.g. vips) now only build worker.min.js, but module registration requests worker.js when SCRIPT_DEBUG was true. Try saying that 10x fast in a row!

pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Mar 19, 2026
This updates the pinned hash from the `gutenberg` from `8c78d87453509661a9f28f978ba2c242d515563b` to `487a096a9782ba6110a7686d7b4b2d0c55ed1b06`.

The following changes are included:

- Disables anchor support for the Page Break block. (WordPress/gutenberg#76434)
- WP Admin: Update Connectors screen footer text for consistency. (WordPress/gutenberg#76382)
- E2E Tests: Add coverage for AI plugin callout banner on Connectors page (WordPress/gutenberg#76432)
- Update sync docs (WordPress/gutenberg#75972)
- RTC: Add preference for collaborator notifications (WordPress/gutenberg#76460)
- Fix "should undo bold" flaky test (WordPress/gutenberg#76464)
- TimePicker: Clamp month day to valid day for month (WordPress/gutenberg#76400)
- RTC: Fix error when entity record doesn't have 'meta' property (WordPress/gutenberg#76311)
- Navigation: Update close button size. (WordPress/gutenberg#76482)
- TemplateContentPanel: fix useSelect warning (WordPress/gutenberg#76421)
- DataViews: Add spinner in `DataViewsLayout` in initial load of data (WordPress/gutenberg#76486) (WordPress/gutenberg#76490)
- RTC: Fix TypeError in areEditorStatesEqual when selection is undefined (WordPress/gutenberg#76163)
- Page/Post Content Focus Mode: Fix insertion into Post Content block (WordPress/gutenberg#76477)
- Revisions: use useSubRegistry={false} to fix global store selectors (WordPress/gutenberg#76152) (WordPress/gutenberg#76522)
- Fix RTL styling on Connectors, Font Library, and boot-based admin pages (WordPress/gutenberg#76496)
- RTC: Auto-register custom taxonomy rest_base values for CRDT sync (WordPress/gutenberg#75983)
- RTC: Add a limit for the default provider (WordPress/gutenberg#76437)
- Fix RTL styling on AI plugin callout banner (WordPress/gutenberg#76497)
- Add command palette trigger button to admin bar (WordPress/gutenberg#75757)
- Block Bindings: Remove source items constrained by enums (WordPress/gutenberg#76200)
- HTML Block: Remove "unsaved changes" check (WordPress/gutenberg#76086)
- CI: Don't build release notes during plugin build workflow for WP Core sync (WordPress/gutenberg#76398) (WordPress/gutenberg#76578)
- CI: Simplify strategy matrix in Build Gutenberg Plugin Zip workflow (WordPress/gutenberg#76435) (WordPress/gutenberg#76538)
- Media: Add hooks and extension points for client-side media processing (WordPress/gutenberg#74913)
- RTC: Fix list sidebar reset during real-time collaboration (WordPress/gutenberg#76025)
- RTC: Fix CRDT serialization of nested RichText attributes (WordPress/gutenberg#76597)
- RTC: Remove post list lock icon and replace user-specific lock text (WordPress/gutenberg#76322)
- Fix HEIC upload error handling and sub-size format (WordPress/gutenberg#76514)
- RTC: Fix cursor index sync with rich text formatting (WordPress/gutenberg#76418)
- RTC: Allow filtering of `SyncConnectionModal` (WordPress/gutenberg#76554)
- RTC: Implement front-end peer limits (WordPress/gutenberg#76565)
- Navigation overlay close button may be displayed twice (WordPress/gutenberg#76585)
- Site Editor > Templates: fix author filter (WordPress/gutenberg#76625)
- Revisions: Show changed block attributes in inspector sidebar (WordPress/gutenberg#76550)
- Fix IS_GUTENBERG_PLUGIN env var override in build config  (WordPress/gutenberg#76605)
- Real Time Collaboration: Introduce filters for the polling intervals. (WordPress/gutenberg#76518)
- RTC: Fix RichTextData deserialization (WordPress/gutenberg#76607)
- Cross Origin Isolation: Remove `img` from the list of elements that get mutated (WordPress/gutenberg#76618)
- RTC: Scroll to collaborator on click (WordPress/gutenberg#76561)
- Update changelog link for pull request 11276 (WordPress/gutenberg#76638)
- Fix backport changelog filename (WordPress/gutenberg#76651)
- Build: Skip non-minified build for WASM-inlined workers (WordPress/gutenberg#76615)
- RTC: Change RTC option name (WordPress/gutenberg#76643)
- BlockListBlock: fix crash when selectedProps are null (WordPress/gutenberg#75826)
- Build: Fix vips worker 404 when SCRIPT_DEBUG is true (WordPress/gutenberg#76657)
- useMediaQuery: support in-iframe queries via new `WindowContext` (WordPress/gutenberg#76446) (WordPress/gutenberg#76660)
- Refactor admin-ui Page component to use @wordpress/theme tokens and @wordpress/ui layout primitive (WordPress/gutenberg#75963)
- Connectors: Improve accessibility (WordPress/gutenberg#76456)
- Build: Remove unused JXL WASM module from vips worker (WordPress/gutenberg#76639)
- Connectors: fix button size (WordPress/gutenberg#76582)
- Compose: Implement useCopyToClipboard and useCopyOnClick with native clipboard API (WordPress/gutenberg#75723) (WordPress/gutenberg#76663)
- Connectors: Fetch specific plugin instead of all plugins (WordPress/gutenberg#76594)
- Revisions: Add Meta fields diff panel to document sidebar (WordPress/gutenberg#76341)
- Loosen client-side media processing requirements (WordPress/gutenberg#76616)
- Reduce the added halo for selected block. (WordPress/gutenberg#76619)
- Connectors: Add unregisterConnector and upsert support (WordPress/gutenberg#76541)

A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/8c78d87453509661a9f28f978ba2c242d515563b…487a096a9782ba6110a7686d7b4b2d0c55ed1b06.

Log created with:

git log --reverse --format="- %s" 8c78d87453509661a9f28f978ba2c242d515563b..487a096a9782ba6110a7686d7b4b2d0c55ed1b06 | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy

See #64595.

git-svn-id: https://develop.svn.wordpress.org/trunk@62063 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Mar 19, 2026
This updates the pinned hash from the `gutenberg` from `8c78d87453509661a9f28f978ba2c242d515563b` to `487a096a9782ba6110a7686d7b4b2d0c55ed1b06`.

The following changes are included:

- Disables anchor support for the Page Break block. (WordPress/gutenberg#76434)
- WP Admin: Update Connectors screen footer text for consistency. (WordPress/gutenberg#76382)
- E2E Tests: Add coverage for AI plugin callout banner on Connectors page (WordPress/gutenberg#76432)
- Update sync docs (WordPress/gutenberg#75972)
- RTC: Add preference for collaborator notifications (WordPress/gutenberg#76460)
- Fix "should undo bold" flaky test (WordPress/gutenberg#76464)
- TimePicker: Clamp month day to valid day for month (WordPress/gutenberg#76400)
- RTC: Fix error when entity record doesn't have 'meta' property (WordPress/gutenberg#76311)
- Navigation: Update close button size. (WordPress/gutenberg#76482)
- TemplateContentPanel: fix useSelect warning (WordPress/gutenberg#76421)
- DataViews: Add spinner in `DataViewsLayout` in initial load of data (WordPress/gutenberg#76486) (WordPress/gutenberg#76490)
- RTC: Fix TypeError in areEditorStatesEqual when selection is undefined (WordPress/gutenberg#76163)
- Page/Post Content Focus Mode: Fix insertion into Post Content block (WordPress/gutenberg#76477)
- Revisions: use useSubRegistry={false} to fix global store selectors (WordPress/gutenberg#76152) (WordPress/gutenberg#76522)
- Fix RTL styling on Connectors, Font Library, and boot-based admin pages (WordPress/gutenberg#76496)
- RTC: Auto-register custom taxonomy rest_base values for CRDT sync (WordPress/gutenberg#75983)
- RTC: Add a limit for the default provider (WordPress/gutenberg#76437)
- Fix RTL styling on AI plugin callout banner (WordPress/gutenberg#76497)
- Add command palette trigger button to admin bar (WordPress/gutenberg#75757)
- Block Bindings: Remove source items constrained by enums (WordPress/gutenberg#76200)
- HTML Block: Remove "unsaved changes" check (WordPress/gutenberg#76086)
- CI: Don't build release notes during plugin build workflow for WP Core sync (WordPress/gutenberg#76398) (WordPress/gutenberg#76578)
- CI: Simplify strategy matrix in Build Gutenberg Plugin Zip workflow (WordPress/gutenberg#76435) (WordPress/gutenberg#76538)
- Media: Add hooks and extension points for client-side media processing (WordPress/gutenberg#74913)
- RTC: Fix list sidebar reset during real-time collaboration (WordPress/gutenberg#76025)
- RTC: Fix CRDT serialization of nested RichText attributes (WordPress/gutenberg#76597)
- RTC: Remove post list lock icon and replace user-specific lock text (WordPress/gutenberg#76322)
- Fix HEIC upload error handling and sub-size format (WordPress/gutenberg#76514)
- RTC: Fix cursor index sync with rich text formatting (WordPress/gutenberg#76418)
- RTC: Allow filtering of `SyncConnectionModal` (WordPress/gutenberg#76554)
- RTC: Implement front-end peer limits (WordPress/gutenberg#76565)
- Navigation overlay close button may be displayed twice (WordPress/gutenberg#76585)
- Site Editor > Templates: fix author filter (WordPress/gutenberg#76625)
- Revisions: Show changed block attributes in inspector sidebar (WordPress/gutenberg#76550)
- Fix IS_GUTENBERG_PLUGIN env var override in build config  (WordPress/gutenberg#76605)
- Real Time Collaboration: Introduce filters for the polling intervals. (WordPress/gutenberg#76518)
- RTC: Fix RichTextData deserialization (WordPress/gutenberg#76607)
- Cross Origin Isolation: Remove `img` from the list of elements that get mutated (WordPress/gutenberg#76618)
- RTC: Scroll to collaborator on click (WordPress/gutenberg#76561)
- Update changelog link for pull request 11276 (WordPress/gutenberg#76638)
- Fix backport changelog filename (WordPress/gutenberg#76651)
- Build: Skip non-minified build for WASM-inlined workers (WordPress/gutenberg#76615)
- RTC: Change RTC option name (WordPress/gutenberg#76643)
- BlockListBlock: fix crash when selectedProps are null (WordPress/gutenberg#75826)
- Build: Fix vips worker 404 when SCRIPT_DEBUG is true (WordPress/gutenberg#76657)
- useMediaQuery: support in-iframe queries via new `WindowContext` (WordPress/gutenberg#76446) (WordPress/gutenberg#76660)
- Refactor admin-ui Page component to use @wordpress/theme tokens and @wordpress/ui layout primitive (WordPress/gutenberg#75963)
- Connectors: Improve accessibility (WordPress/gutenberg#76456)
- Build: Remove unused JXL WASM module from vips worker (WordPress/gutenberg#76639)
- Connectors: fix button size (WordPress/gutenberg#76582)
- Compose: Implement useCopyToClipboard and useCopyOnClick with native clipboard API (WordPress/gutenberg#75723) (WordPress/gutenberg#76663)
- Connectors: Fetch specific plugin instead of all plugins (WordPress/gutenberg#76594)
- Revisions: Add Meta fields diff panel to document sidebar (WordPress/gutenberg#76341)
- Loosen client-side media processing requirements (WordPress/gutenberg#76616)
- Reduce the added halo for selected block. (WordPress/gutenberg#76619)
- Connectors: Add unregisterConnector and upsert support (WordPress/gutenberg#76541)

A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/8c78d87453509661a9f28f978ba2c242d515563b…487a096a9782ba6110a7686d7b4b2d0c55ed1b06.

Log created with:

git log --reverse --format="- %s" 8c78d87453509661a9f28f978ba2c242d515563b..487a096a9782ba6110a7686d7b4b2d0c55ed1b06 | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy

See #64595.
Built from https://develop.svn.wordpress.org/trunk@62063


git-svn-id: http://core.svn.wordpress.org/trunk@61345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
adamsilverstein added a commit that referenced this pull request Mar 23, 2026
Resolve conflicts with #76615 and #76657 which landed the unminified
worker skip and SCRIPT_DEBUG fallback. Keep trunk's isWasmWorker/min_only
approach and add sourcemap suppression for WASM workers. Remove the
unused wpScriptDebugSupport flag and related dead code paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
adamsilverstein added a commit that referenced this pull request Mar 31, 2026
Co-authored-by: adamsilverstein <adamsilverstein@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: adamziel <zieladam@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backported to WP Core Pull request that has been successfully merged into WP Core [Feature] Client Side Media Media processing in the browser with WASM [Package] wp-build /packages/wp-build [Type] Build Tooling Issues or PRs related to build tooling

3 participants