Make WordPress Core

Changeset 61794


Ignore:
Timestamp:
03/03/2026 01:45:29 PM (6 weeks ago)
Author:
adamsilverstein
Message:

General: VIPS library omit un-minimized and .map files.

Omit these files which offer little value since the VIPS library is primarily inlined WASM. Saves ~30MB total from the build output.

Props swissspidy, westonruter, adamsilverstein, berislav.grgicak, knutsp.
Fixes: #64734.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-modules.php

    r61611 r61794  
    191191        }
    192192
     193        // VIPS files are always minified — the non-minified versions are not
     194        // shipped because they are ~10MB of inlined WASM with no debugging value.
     195        if ( str_starts_with( $file_name, 'vips/' ) && ! str_contains( $file_name, '.min.' ) ) {
     196            $file_name = str_replace( '.js', '.min.js', $file_name );
     197        }
     198
    193199        $path        = includes_url( "js/dist/script-modules/{$file_name}" );
    194200        $module_deps = $script_module_data['module_dependencies'] ?? array();
  • trunk/tests/phpunit/tests/script-modules/wpScriptModules.php

    r61587 r61794  
    19051905
    19061906    /**
     1907     * Tests that VIPS script modules always use minified file paths.
     1908     *
     1909     * Non-minified VIPS files are not shipped because they are ~10MB of
     1910     * inlined WASM with no debugging value, so the registration should
     1911     * always point to the .min.js variants.
     1912     *
     1913     * @ticket 64734
     1914     *
     1915     * @covers ::wp_default_script_modules
     1916     */
     1917    public function test_vips_script_modules_always_use_minified_paths() {
     1918        wp_default_script_modules();
     1919        wp_enqueue_script_module( '@wordpress/vips/loader' );
     1920
     1921        $actual = get_echo( array( wp_script_modules(), 'print_enqueued_script_modules' ) );
     1922
     1923        $this->assertStringContainsString( 'vips/loader.min.js', $actual );
     1924        $this->assertStringNotContainsString( 'vips/loader.js"', $actual );
     1925    }
     1926
     1927    /**
    19071928     * Normalizes markup for snapshot.
    19081929     *
  • trunk/tools/gutenberg/copy-gutenberg-build.js

    r61703 r61794  
    168168            copyDirectory( srcPath, destPath, transform, options );
    169169        } else {
     170            // Skip source map files (.map) — these are not useful in Core
     171            // and the sourceMappingURL references are already stripped from JS files.
     172            if ( /\.map$/.test( entry.name ) ) {
     173                continue;
     174            }
     175
     176            // Skip non-minified VIPS files — they are ~10MB of inlined WASM
     177            // with no debugging value over the minified versions.
     178            if (
     179                srcPath.includes( '/vips/' ) &&
     180                /(?<!\.min)\.js$/.test( entry.name )
     181            ) {
     182                continue;
     183            }
     184
    170185            // Skip PHP files if excludePHP is true
    171186            if ( options.excludePHP && /\.php$/.test( entry.name ) ) {
Note: See TracChangeset for help on using the changeset viewer.