Skip to content

Build: Remove unused JXL WASM module from vips worker#76617

Closed
adamsilverstein wants to merge 1 commit into
WordPress:trunkfrom
adamsilverstein:fix/vips-remove-jxl
Closed

Build: Remove unused JXL WASM module from vips worker#76617
adamsilverstein wants to merge 1 commit into
WordPress:trunkfrom
adamsilverstein:fix/vips-remove-jxl

Conversation

@adamsilverstein
Copy link
Copy Markdown
Member

Summary

Removes the unused vips-jxl.wasm module from the vips worker bundle to reduce build size. WordPress Core does not currently support JXL images — it is not in CLIENT_SIDE_SUPPORTED_MIME_TYPES — so this WASM module is loaded but never used.

Size impact

Before After Saved
worker.min.js 16.1 MB (16,859,314 bytes) 13.1 MB (13,749,830 bytes) 3.1 MB (18.4%)

Changes

  • Removed the vips-jxl.wasm import from packages/vips/src/index.ts
  • Updated dynamicLibraries to only load vips-heif.wasm (still needed for HEIF/HEIC input and AVIF support)
  • Removed the JXL branch from the locateFile callback

Future size reduction opportunities

Beyond this PR, a custom wasm-vips build could yield further savings:

Optimization Estimated savings
Enable LTO (--enable-lto) ~1.6–3.2 MB
Remove unused libs from vips.wasm (TIFF, imagequant, expat) ~0.5 MB
Web-only build (-e web) minor
Combined additional ~2–4 MB
Total potential (including this PR) worker.min.js ~10 MB

See also:

Re-adding JXL

If WordPress Core adds JXL support in the future, it can be trivially restored by:

  1. Re-adding import VipsJxlModule from 'wasm-vips/vips-jxl.wasm'
  2. Adding 'vips-jxl.wasm' back to the dynamicLibraries array
  3. Adding the JXL branch to locateFile

Test plan

  • Run npm run build and verify build/modules/vips/worker.min.js is ~13.1 MB (down from 16.1 MB)
  • Test image upload/processing in the editor (JPEG, PNG, WebP, GIF, AVIF)
  • Test HEIF/HEIC image upload (should still convert correctly via vips-heif.wasm)
  • Verify no JXL-related errors in console

🤖 Generated with Claude Code

WordPress Core does not currently support JXL images - it is not
in CLIENT_SIDE_SUPPORTED_MIME_TYPES. Removing the unused vips-jxl.wasm
import reduces the worker bundle from 16.1 MB to 13.1 MB (3.0 MB / 18%).

JXL support can be trivially re-added by restoring the import and
adding 'vips-jxl.wasm' back to the dynamicLibraries array when
Core adds JXL support.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@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: adamsilverstein <adamsilverstein@git.wordpress.org>

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

@adamsilverstein
Copy link
Copy Markdown
Member Author

Reopened from origin branch as #76639

@adamsilverstein adamsilverstein deleted the fix/vips-remove-jxl branch March 18, 2026 15:33
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