Skip to content

Build: Reduce VIPS build size by excluding .map and non-minified files#11109

Closed
adamsilverstein wants to merge 5 commits intoWordPress:trunkfrom
adamsilverstein:64734-built-vips-too-large
Closed

Build: Reduce VIPS build size by excluding .map and non-minified files#11109
adamsilverstein wants to merge 5 commits intoWordPress:trunkfrom
adamsilverstein:64734-built-vips-too-large

Conversation

@adamsilverstein
Copy link
Member

@adamsilverstein adamsilverstein commented Mar 2, 2026

Summary

  • Skip .map source map files in copyDirectory() — sourceMappingURL references are already stripped from JS files by the existing removeSourceMaps transform, so the .map files serve no purpose in Core
  • Skip non-minified VIPS JS files — they are ~10MB of inlined WASM binary data with no debugging value over the minified versions
  • Always load minified VIPS script modules in wp_default_script_modules(), so SCRIPT_DEBUG mode resolves to the .min.js files that exist on disk
  • Saves ~30MB total from the build output

Fixes https://core.trac.wordpress.org/ticket/64734

Test plan

  • Run node tools/gutenberg/copy-gutenberg-build.js and verify no .map files are copied
  • Verify VIPS directory only contains minified files (worker.min.js, loader.min.js, asset PHP files)
  • Verify other script module packages still have their expected files
  • Confirm overall build size reduction (~30MB savings)
  • Verify VIPS still loads correctly with SCRIPT_DEBUG enabled

Trac ticket: https://core.trac.wordpress.org/ticket/64734

Source map files serve no purpose in Core since sourceMappingURL
references are already stripped. Non-minified VIPS files are ~10MB
of inlined WASM with no debugging value. Saves ~30MB total.
@github-actions
Copy link

github-actions bot commented Mar 2, 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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props adamsilverstein, swissspidy, westonruter.

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

@github-actions
Copy link

github-actions bot commented Mar 2, 2026

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@adamsilverstein
Copy link
Member Author

@youknowriad maybe simpler to exclude here for now?

Non-minified VIPS files are excluded from the build since
they are ~10MB of inlined WASM with no debugging value.
This ensures SCRIPT_DEBUG mode still resolves to the
minified versions that exist on disk.
@adamsilverstein adamsilverstein changed the title Build: Exclude .map and non-minified VIPS files during Gutenberg copy Build: Reduce VIPS build size by excluding .map and non-minified files Mar 2, 2026
@adamsilverstein
Copy link
Member Author

This worked well in my testing, committing.

@westonruter
Copy link
Member

Committed in r61794 (8db1867).

(Not sure why this PR wasn't closed automatically with the commit.)

@westonruter westonruter closed this Mar 3, 2026
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.

3 participants