Open emersonlaurentino opened 2 weeks ago
I'm not sure marking it as external would solve your problem, since during runtime it would still try to import it and fail. I'd be curious why the module doesn't exist for you, do you need to manually install it?
As a workaround we support module aliasing now (via https://github.com/cloudflare/workers-sdk/pull/6167, pending documentation), so you can add this to wrangler.toml
[alias]
"@node-rs/argon2-wasm32-wasi" = "./some-file.js"
so that it resolves to something you export in some-file.js
. I'm not sure it fixes your problem, but may give you a path forward.
I guess the problem is that since it is a WASI library it will be pulling in a WASM binary file, which cannot be bundled directly. I wonder if adding a "rule" in wrangler.toml to tell that this file is a WASM would help:
wrangler.toml
[[rules]]
globs = ["@node-rs/argon2-wasm32-wasi"]
type = "CompiledWasm"
Describe the solution
Add support to configure external libs to esbuild config.
Explanation:
Currently, I'm using the
@node-rs/argon2
dependency, and I'm receiving this error when run the commandwrangler dev
:The solution is adding this lib to external on esbuild config, but we can't because we don't have access to esbuild config.