From bb28d7c77294a1af8e28d774599d5c17634238f2 Mon Sep 17 00:00:00 2001 From: adamsilverstein Date: Mon, 2 Mar 2026 18:24:58 +0700 Subject: [PATCH 1/3] Build: Exclude .map and non-minified VIPS files during Gutenberg copy 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. --- tools/gutenberg/copy-gutenberg-build.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/gutenberg/copy-gutenberg-build.js b/tools/gutenberg/copy-gutenberg-build.js index 0d1c454ca8085..a0117785abad7 100644 --- a/tools/gutenberg/copy-gutenberg-build.js +++ b/tools/gutenberg/copy-gutenberg-build.js @@ -167,6 +167,21 @@ function copyDirectory( src, dest, transform = null, options = {} ) { copyDirectory( srcPath, destPath, transform, options ); } else { + // Skip source map files (.map) — these are not useful in Core + // and the sourceMappingURL references are already stripped from JS files. + if ( /\.map$/.test( entry.name ) ) { + continue; + } + + // Skip non-minified VIPS files — they are ~10MB of inlined WASM + // with no debugging value over the minified versions. + if ( + srcPath.includes( '/vips/' ) && + /(? Date: Mon, 2 Mar 2026 19:08:22 +0700 Subject: [PATCH 2/3] Build: Always load minified VIPS script modules 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. --- src/wp-includes/script-modules.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wp-includes/script-modules.php b/src/wp-includes/script-modules.php index 0a39efea1dc27..411325be3618e 100644 --- a/src/wp-includes/script-modules.php +++ b/src/wp-includes/script-modules.php @@ -190,6 +190,12 @@ function wp_default_script_modules() { wp_interactivity()->add_client_navigation_support_to_script_module( $script_module_id ); } + // VIPS files are always minified — the non-minified versions are not + // shipped because they are ~10MB of inlined WASM with no debugging value. + if ( str_starts_with( $file_name, 'vips/' ) && ! str_contains( $file_name, '.min.' ) ) { + $file_name = str_replace( '.js', '.min.js', $file_name ); + } + $path = includes_url( "js/dist/script-modules/{$file_name}" ); $module_deps = $script_module_data['module_dependencies'] ?? array(); wp_register_script_module( $script_module_id, $path, $module_deps, $script_module_data['version'], $args ); From 18c3184f6497909b2862e14b505f97e7ee529a35 Mon Sep 17 00:00:00 2001 From: adamsilverstein Date: Mon, 2 Mar 2026 19:35:02 +0700 Subject: [PATCH 3/3] Tests: Add test for VIPS minified path fallback --- .../tests/script-modules/wpScriptModules.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/phpunit/tests/script-modules/wpScriptModules.php b/tests/phpunit/tests/script-modules/wpScriptModules.php index 3b7de73c71b63..140531101a1cd 100644 --- a/tests/phpunit/tests/script-modules/wpScriptModules.php +++ b/tests/phpunit/tests/script-modules/wpScriptModules.php @@ -1903,6 +1903,27 @@ public function test_dependent_of_default_script_modules() { $this->assertEqualHTML( $expected, $actual ); } + /** + * Tests that VIPS script modules always use minified file paths. + * + * Non-minified VIPS files are not shipped because they are ~10MB of + * inlined WASM with no debugging value, so the registration should + * always point to the .min.js variants. + * + * @ticket 64734 + * + * @covers ::wp_default_script_modules + */ + public function test_vips_script_modules_always_use_minified_paths() { + wp_default_script_modules(); + wp_enqueue_script_module( '@wordpress/vips/loader' ); + + $actual = get_echo( array( wp_script_modules(), 'print_enqueued_script_modules' ) ); + + $this->assertStringContainsString( 'vips/loader.min.js', $actual ); + $this->assertStringNotContainsString( 'vips/loader.js"', $actual ); + } + /** * Normalizes markup for snapshot. *