diff --git a/packages/vips/src/index.ts b/packages/vips/src/index.ts index 708df6fa284128..f0803c4da36ea3 100644 --- a/packages/vips/src/index.ts +++ b/packages/vips/src/index.ts @@ -6,9 +6,6 @@ import Vips from 'wasm-vips'; // @ts-expect-error - WASM files are inlined as base64 data URLs at build time import VipsModule from 'wasm-vips/vips.wasm'; -// @ts-expect-error - WASM files are inlined as base64 data URLs at build time -import VipsJxlModule from 'wasm-vips/vips-jxl.wasm'; - // @ts-expect-error - WASM files are inlined as base64 data URLs at build time import VipsHeifModule from 'wasm-vips/vips-heif.wasm'; @@ -44,17 +41,16 @@ async function getVips(): Promise< typeof Vips > { } vipsInstance = await Vips( { - // Load JXL and HEIF dynamic modules for full format support. - // wasm-vips defaults to ["vips-jxl.wasm", "vips-heif.wasm"]. - dynamicLibraries: [ 'vips-jxl.wasm', 'vips-heif.wasm' ], + // Load HEIF dynamic module for HEIF/HEIC and AVIF format support. + // JXL is omitted as WordPress Core does not currently support it. + // It can be re-added when Core adds JXL support. + dynamicLibraries: [ 'vips-heif.wasm' ], locateFile: ( fileName: string ) => { // WASM files are inlined as base64 data URLs at build time, // eliminating the need for separate file downloads and avoiding // issues with hosts not serving WASM files with correct MIME types. if ( fileName.endsWith( 'vips.wasm' ) ) { return VipsModule; - } else if ( fileName.endsWith( 'vips-jxl.wasm' ) ) { - return VipsJxlModule; } else if ( fileName.endsWith( 'vips-heif.wasm' ) ) { return VipsHeifModule; } diff --git a/test/e2e/specs/editor/various/wasm-inlining.spec.js b/test/e2e/specs/editor/various/wasm-inlining.spec.js index c753f3a2812f89..a0061f78602d59 100644 --- a/test/e2e/specs/editor/various/wasm-inlining.spec.js +++ b/test/e2e/specs/editor/various/wasm-inlining.spec.js @@ -38,18 +38,10 @@ test.describe( 'WASM Inlining (build verification)', () => { ); } ); - test( 'should inline vips-jxl.wasm as base64 data URL', () => { - // Verify vips-jxl.wasm is inlined - // Variable name: vips_jxl_default (from wasm-vips/vips-jxl.wasm) - expect( buildContent ).toMatch( - /var vips_jxl_default\s*=\s*"data:application\/wasm;base64,/ - ); - } ); - test( 'should have substantial inlined WASM data', () => { // The inlined WASM should be large (original files are several MB) // This ensures we're actually inlining the full WASM, not just a stub - // The built file should be at least 10MB due to the inlined WASM - expect( buildContent.length ).toBeGreaterThan( 10 * 1024 * 1024 ); + // The built file should be at least 5MB due to the inlined WASM + expect( buildContent.length ).toBeGreaterThan( 5 * 1024 * 1024 ); } ); } );