napi-rs / napi-rs/node-rs

SvelteKit 2 & Cloudflare Page: Could not resolve "@node-rs/argon2-wasm32-wasi"

Open
#862 18 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.5k
Forks
52
Avg merge
13h 37m
Merged PRs (30d)
19

Description

I made a project to reproduce the error here:
https://github.com/Shyrogan/sveltekit-argon2-cf-error

> Using @sveltejs/adapter-cloudflare
✘ [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.


error during build:
Error: Bundling with esbuild failed with 1 error
    at adapt (file:///Users/sebastienvial/Documents/transitions.ag/cloudflare-pages-sveltekit/node_modules/@sveltejs/adapter-cloudflare/index.js:134:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async adapt (file:///Users/sebastienvial/Documents/transitions.ag/cloudflare-pages-sveltekit/node_modules/@sveltejs/kit/src/core/adapt/index.js:38:2)
    at async finalise (file:///Users/sebastienvial/Documents/transitions.ag/cloudflare-pages-sveltekit/node_modules/@sveltejs/kit/src/exports/vite/index.js:890:7)
    at async Object.handler (file:///Users/sebastienvial/Documents/transitions.ag/cloudflare-pages-sveltekit/node_modules/@sveltejs/kit/src/exports/vite/index.js:920:5)
    at async PluginDriver.hookParallel (file:///Users/sebastienvial/Documents/transitions.ag/cloudflare-pages-sveltekit/node_modules/rollup/dist/es/shared/node-entry.js:19730:17)
    at async Object.close (file:///Users/sebastienvial/Documents/transitions.ag/cloudflare-pages-sveltekit/node_modules/rollup/dist/es/shared/node-entry.js:20665:13)
    at async build (file:///Users/sebastienvial/Documents/transitions.ag/cloudflare-pages-sveltekit/node_modules/vite/dist/node/chunks/dep-D8YhmIY-.js:65760:17)
    at async CAC.<anonymous> (file:///Users/sebastienvial/Documents/transitions.ag/cloudflare-pages-sveltekit/node_modules/vite/dist/node/cli.js:828:5)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction and inspect the @node-rs/argon2/browser.js import shown in the adapter-cloudflare build error. Run the SvelteKit build from the reproduction to confirm the unresolved @node-rs/argon2-wasm32-wasi failure; done means the reproducer builds without that resolution error.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, rust, wasm
Domain
build-system, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.