WASM files from the dependencies are not copied during the build
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 899
- Avg merge
- 2d 24m
- Merged PRs (30d)
- 40
Description
Describe the bug
When you build the Nitro.js project which depends on tesseract.js (which in turn depends on tesseract.js-core), the wasm files are not copied from the tesseract.js-core package to the output directory.
Reproduction
Clone and build the project:
git clone https://github.com/slavafomin/nitro-wasm-issue && cd nitro-wasm-issue
npm install
DEV mode:
npm run dev
open "http://localhost:3001"
Everything should work.
Production mode:
npm run build
node ./.output/server/index.mjs
open "http://localhost:3000"
Getting error:
Aborted(Error: ENOENT: no such file or directory, open '/nitro-wasm-issue/.output/server/node_modules/tesseract.js-core/tesseract-core-simd.wasm')
failed to asynchronously prepare wasm: RuntimeError: Aborted(Error: ENOENT: no such file or directory, open '/nitro-wasm-issue/.output/server/node_modules/tesseract.js-core/tesseract-core-simd.wasm'). Build with -sASSERTIONS for more info.
Aborted(RuntimeError: Aborted(Error: ENOENT: no such file or directory, open '/nitro-wasm-issue/.output/server/node_modules/tesseract.js-core/tesseract-core-simd.wasm'). Build with -sASSERTIONS for more info.)
[uncaughtException] Error [RuntimeError]: Aborted(Error: ENOENT: no such file or directory, open '/nitro-wasm-issue/.output/server/node_modules/tesseract.js-core/tesseract-core-simd.wasm'). Build with -sASSERTIONS for more info.
at n (/nitro-wasm-issue/.output/server/node_modules/tesseract.js-core/tesseract-core-simd.js:13:225)
at Ma (/nitro-wasm-issue/.output/server/node_modules/tesseract.js-core/tesseract-core-simd.js:14:143)
at /nitro-wasm-issue/.output/server/node_modules/tesseract.js-core/tesseract-core-simd.js:14:491
WASM files are missing from the dependency:
ls -lah ./.output/server/node_modules/tesseract.js-core/*.wasm
ls: cannot access './.output/server/node_modules/tesseract.js-core/*.wasm': No such file or directory
Environment
$ node --version
v22.19.0
$ npm --version
11.6.0
$ npx nitro --version
2.12.6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the production build with the linked Nitro.js example using npm run build, then inspect the build output under .output/server/node_modules/tesseract.js-core and the dependency handling used by the production build. The fix is complete when the required .wasm files are present in the output and node ./.output/server/index.mjs runs without the ENOENT error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100