magick-wasm exports invalid module-type file #119
Replies: 3 comments 25 replies
-
I don't understand how you are using this project. This error must be related to how you are using this project. |
Beta Was this translation helpful? Give feedback.
-
Do you need a new release to test this @iambumblehead or do you have other methods to test this? |
Beta Was this translation helpful? Give feedback.
-
I just ran into a similar issue when trying to use file:///Users/winston/Code/catppuccin/vscode-icons/node_modules/@imagemagick/magick-wasm/dist/index.mjs:22
var Ut = require("fs"), jt = require("path");
^
ReferenceError: require is not defined in ES module scope, you can use import instead
at <anonymous> (/Users/winston/Code/catppuccin/vscode-icons/node_modules/@imagemagick/magick-wasm/dist/index.mjs:8072:980)
at <anonymous> (/Users/winston/Code/catppuccin/vscode-icons/node_modules/@imagemagick/magick-wasm/dist/index.mjs:8072:980)
at new Promise (<anonymous>)
at f.loader (/Users/winston/Code/catppuccin/vscode-icons/node_modules/@imagemagick/magick-wasm/dist/index.mjs:8072:980)
at f._initialize (/Users/winston/Code/catppuccin/vscode-icons/node_modules/@imagemagick/magick-wasm/dist/index.mjs:8072:980)
at Qu (/Users/winston/Code/catppuccin/vscode-icons/node_modules/@imagemagick/magick-wasm/dist/index.mjs:8072:980)
at <anonymous> (/Users/winston/Code/catppuccin/vscode-icons/scripts/catwalk.ts:14:7)
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
Node.js v18.18.2 I pulled the latest file:///Users/winston/Code/catppuccin/vscode-icons/node_modules/@imagemagick/magick-wasm/dist/index.mjs:56
pe ? ie = $t.dirname(ie) + "/" : ie = __dirname + "/", et = (t, r) => (t = St(t) ? new URL(t) : $t.normalize(t), jt.readFileSync(t, r ? void 0 : "utf8")), dt = (t) => {
^
ReferenceError: __dirname is not defined in ES module scope
at file:///Users/winston/Code/catppuccin/vscode-icons/node_modules/@imagemagick/magick-wasm/dist/index.mjs:56:47
at file:///Users/winston/Code/catppuccin/vscode-icons/node_modules/@imagemagick/magick-wasm/dist/index.mjs:7347:7
at new Promise (<anonymous>)
at f.loader (file:///Users/winston/Code/catppuccin/vscode-icons/node_modules/@imagemagick/magick-wasm/dist/index.mjs:7341:26)
at f._initialize (file:///Users/winston/Code/catppuccin/vscode-icons/node_modules/@imagemagick/magick-wasm/dist/index.mjs:7363:16)
at no (file:///Users/winston/Code/catppuccin/vscode-icons/node_modules/@imagemagick/magick-wasm/dist/index.mjs:7400:12)
at <anonymous> (/Users/winston/Code/catppuccin/vscode-icons/scripts/catwalk.ts:14:7)
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
Node.js v18.18.2 Code to reproduce: import { initializeImageMagick } from "@imagemagick/magick-wasm";
await initializeImageMagick();
{
"type": "module",
"devDependencies": {
"@imagemagick/magick-wasm": "/Users/winston/Code/magick-wasm/imagemagick-magick-wasm-0.0.24.tgz",
"tsx": "^3.12.7"
}
} $ tsx ./catwalk.ts
> results in error above |
Beta Was this translation helpful? Give feedback.
-
magick-wasm version
0.0.24
Description
index.mjs has this...
Steps to Reproduce
initializeImageMagick('@imagemagick/magick-wasm')
ReferenceError [Error]: require is not defined
Images
No response
Beta Was this translation helpful? Give feedback.
All reactions