You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I try to import a wasm module from an npm package in my worker using the node module resolution, for example:
import JPEG_DEC_WASM from '@jsquash/jpeg/codec/dec/mozjpeg_dec.wasm';
I get the following error when running wrangler dev:
✘ [ERROR] ENOENT: no such file or directory, open '/Users/foo/bar/src/@jsquash/jpeg/codec/dec/mozjpeg_dec.wasm' [plugin wrangler-module-collector]
src/jsquash-transform.ts:3:26:
3 │ import JPEG_DEC_WASM from '@jsquash/jpeg/codec/dec/mozjpeg_dec.wasm';
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This error came from the "onResolve" callback registered here:
node_modules/.pnpm/wrangler@3.22.3_patch_hash=whuv2ih5kundyyu7rtaqweiv2a/node_modules/wrangler/wrangler-dist/cli.js:123256:19:
123256 │ build5.onResolve(
╵ ~~~~~~~~~
at /Users/foo/bar/node_modules/.pnpm/wrangler@3.22.3_patch_hash=whuv2ih5kundyyu7rtaqweiv2a/node_modules/wrangler/wrangler-dist/cli.js:123256:20
at Array.forEach (<anonymous>)
at /Users/foo/bar/node_modules/.pnpm/wrangler@3.22.3_patch_hash=whuv2ih5kundyyu7rtaqweiv2a/node_modules/wrangler/wrangler-dist/cli.js:123255:22
at Array.forEach (<anonymous>)
The only way I was able to get this to work was by using a relative path to the module rather than node module resolution:
import JPEG_DEC_WASM from '../node_modules/@jsquash/jpeg/codec/dec/mozjpeg_dec.wasm';
The module resolution should work the same for both js/ts and wasm files.
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs
No response
The text was updated successfully, but these errors were encountered:
Which Cloudflare product(s) does this pertain to?
Wrangler core
What version(s) of the tool(s) are you using?
3.22.3
What version of Node are you using?
20.10.0
What operating system are you using?
Mac
Describe the Bug
If I try to import a wasm module from an npm package in my worker using the node module resolution, for example:
I get the following error when running
wrangler dev
:The only way I was able to get this to work was by using a relative path to the module rather than node module resolution:
The module resolution should work the same for both js/ts and wasm files.
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs
No response
The text was updated successfully, but these errors were encountered: