Make WordPress Core

#64884 closed defect (bug) (fixed)

Build: Exclude non-minified VIPS files from grunt module copy

Reported by: adamsilverstein's profile adamsilverstein Owned by: adamsilverstein's profile adamsilverstein
Milestone: 7.0 Priority: normal
Severity: normal Version: trunk
Component: Build/Test Tools Keywords: has-patch commit
Focuses: Cc:

Description (last modified by adamsilverstein)

Summary

The gutenberg-modules grunt copy task in Gruntfile.js copies all script module files from the Gutenberg build except .map files. However, it does not exclude non-minified VIPS files, which are ~16MB of base64-encoded inlined WASM data. The non-minified worker.js is nearly identical in size to worker.min.js (minification has negligible effect on base64-encoded binary data) and provides no debugging value.

The existing tools/gutenberg/copy.js already has this exclusion (lines 213-220), but the Gruntfile's copy:gutenberg-modules task — which performs the actual module copy during grunt build:gutenberg — was missing the equivalent filter. This results in both worker.js (~16MB) and worker.min.js (~16MB) being included in the build output unnecessarily.

Steps to Reproduce

  1. Run npx grunt build:gutenberg
  2. Check build/wp-includes/js/dist/script-modules/vips/
  3. Observe both worker.js and worker.min.js are present, nearly identical in size (~16MB each)

Expected Behavior

Only worker.min.js should be present in the build output, since the non-minified version provides no additional value for WASM-inlined content.

Proposed Change

Add a glob exclusion !vips/!(*.min).js to the gutenberg-modules copy task's src array in Gruntfile.js, matching the filter already in tools/gutenberg/copy.js.

PR: https://github.com/WordPress/wordpress-develop/pull/11281
Companion Gutenberg PR: https://github.com/WordPress/gutenberg/pull/76615

Change History (5)

#1 @adamsilverstein
14 hours ago

  • Description modified (diff)

This ticket was mentioned in PR #11281 on WordPress/wordpress-develop by @adamsilverstein.


14 hours ago
#2

## Summary

Adds exclusion for non-minified VIPS files in the gutenberg-modules grunt copy task.

### Why

The VIPS worker files are ~16 MB of inlined WASM data where minification has negligible effect — worker.js and worker.min.js are nearly identical in size. This filter was already present in tools/gutenberg/copy.js (lines 213-220) but was missing from the Gruntfile grunt copy task that performs the actual module copy during grunt build:gutenberg.

### Size impact

Before After Saved
wp-includes/js/dist/script-modules/vips/ ~32 MB (worker.js + worker.min.js) ~16 MB (worker.min.js only) ~16 MB

### Related PRs for further size reduction (in Gutenberg)

## Test plan

  • [ ] Run npx grunt build:gutenberg — verify build/wp-includes/js/dist/script-modules/vips/ contains worker.min.js but NOT worker.js
  • [ ] Run PHP tests: vendor/bin/phpunit tests/phpunit/tests/script-modules/wpScriptModules.php

@desrosj commented on PR #11281:


12 hours ago
#3

Thanks @adamsilverstein!

One note, these files will not explicitly be removed from the build server until Core-64716 is addressed. The files are not cleaned up on the build server before rerunning npm run build with the changed source files, so the files remain under version control.

I am hoping to refresh #11036 shortly to have it in ahead of RC1.

#4 @adamsilverstein
2 hours ago

  • Keywords commit added
  • Owner set to adamsilverstein
  • Status changed from new to assigned

#5 @adamsilverstein
80 minutes ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 62055:

Build: Exclude non-minified VIPS files from grunt module copy.

Add an exclusion for non-minified VIPS files to match the existing filter in tools/gutenberg/copy.js. This prevents ~16 MB worker.js from being copied alongside the nearly identically-sized worker.min.js.

Props adamsilverstein, zieladam, desrosj.
Fixes #64884.

Note: See TracTickets for help on using tickets.