From 582f99588f9f764dada721c73ae37a33b2b21509 Mon Sep 17 00:00:00 2001 From: JovannMC Date: Sat, 15 Feb 2025 13:53:59 +0300 Subject: [PATCH] fix: fix AVIF/JXL support we need to copy the vips-*.wasm files from node_modules into vite's workers folder --- src/lib/converters/vips.svelte.ts | 4 ++-- src/lib/workers/vips.ts | 2 +- vite.config.ts | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/converters/vips.svelte.ts b/src/lib/converters/vips.svelte.ts index 6ebf401..33fa389 100644 --- a/src/lib/converters/vips.svelte.ts +++ b/src/lib/converters/vips.svelte.ts @@ -34,8 +34,8 @@ export class VipsConverter extends Converter { ".tiff", ".jfif", //".heif", HEIF files that are encoded like HEIC files (and HEIC files in general) aren't supported due to https://github.com/kleisauke/wasm-vips/issues/3 - //".avif", there is an issue with vite not bundling the wasm-vips' dynamicLibraries wasm files correctly - //".jxl", + ".avif", + ".jxl", ]; public readonly reportsProgress = false; diff --git a/src/lib/workers/vips.ts b/src/lib/workers/vips.ts index ad54736..35665ed 100644 --- a/src/lib/workers/vips.ts +++ b/src/lib/workers/vips.ts @@ -1,6 +1,6 @@ import Vips from "wasm-vips"; -const vipsPromise = Vips({ dynamicLibraries: [] }); +const vipsPromise = Vips(); vipsPromise .then(() => { diff --git a/vite.config.ts b/vite.config.ts index 07f3d05..c4ec1e8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -38,6 +38,10 @@ export default defineConfig({ src: "_headers", dest: "", }, + { + src: "node_modules/wasm-vips/lib/vips-*.wasm", + dest: "_app/immutable/workers", + }, ], }), ],