image-resizing-api icon indicating copy to clipboard operation
image-resizing-api copied to clipboard

issue: ReferenceError: __dirname is not defined

Open bansal opened this issue 1 year ago • 1 comments

I am getting this error:

gcp-us-east4 isolate start time: 111.91 ms
gcp-us-east4 Listening on http://localhost:80/
gcp-asia-south1 ReferenceError: __dirname is not defined
    at https://deno.land/x/[email protected]/src/wasm/magick_native.js:9:1767
    at https://deno.land/x/[email protected]/src/image-magick.ts:26:7
    at new Promise (<anonymous>)
    at new ImageMagick (https://deno.land/x/[email protected]/src/image-magick.ts:20:19)
    at Function._create (https://deno.land/x/[email protected]/src/image-magick.ts:38:39)
    at https://deno.land/x/[email protected]/src/image-magick.ts:239:30

bansal avatar Dec 06 '24 10:12 bansal

Change the wasm import to (update the version):

import {
    ImageMagick,
    initializeImageMagick,
    MagickGeometry,
} from "https://deno.land/x/[email protected]/mod.ts";

But then you'll have a new error about not being able to read magick.wasm (invalid URL).

Good luck!

tedsecretsource avatar Jun 25 '25 10:06 tedsecretsource