Bundling with Workers

I have a monorepo using npm workspaces, and I'm trying to set things up so that I can deploy to workers.

However, when I run wrangler deploy I get the following:

X [ERROR] Could not resolve "@node-rs/argon2-wasm32-wasi"

      node_modules/@node-rs/argon2/browser.js:1:14:
        1 │ export * from '@node-rs/argon2-wasm32-wasi'
          ╵               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    You can mark the path "@node-rs/argon2-wasm32-wasi" as external to exclude it from the bundle,
  which will remove this error and leave the unresolved path in the bundle.


Ordinarily, I'd just mark node-rs/argon2-wasm32-wasi as external in my esbuild config, but it doesn't look like Cloudflare lets you modify specifics of the esbuild config. I read about rules but I can't figure out a way to resolve this issue with those.

Secondly, I have this error for more than just one package, so I'd end up having to exclude several different packages. If this happened, is there a way for me to ensure the modules end up in the build output, aside from manually copying them over with a script or similar? Or is this situation one where I'd probably be best off bypassing the cloudflare bundler altogether and just handling that myself with --no-bundle=true or whatever it's called?

Thanks!
Was this page helpful?