oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
72.09k stars 2.58k forks source link

bun build --compile fails if dependency uses wasm #6567

Open roninjin10 opened 9 months ago

roninjin10 commented 9 months ago

What version of Bun is running?

1.0.6+969da088f5db3258a803ec186012e30f992829b4

What platform is your computer?

macos Darwin 22.6.0 arm64 arm

What steps can reproduce the bug?

Install a node module like ink that has wasm in it

bun install ink

Add it to an index.ts

console.log(await import('ink'))

It will fail

What is the expected behavior?

Should work

What do you see instead?

➜ minimal-bun-repro bun start $ bun build ./index.ts --compile --outfile mycli && ./mycli [29ms] bundle 112 modules [88ms] compile mycli

error: Cannot find module "./yoga.wasm" from "compi

Additional information

Minimal repro here git@github.com:roninjin10/minimal-bun-repro.git

git clone git@github.com:roninjin10/minimal-bun-repro.git
cd minimal-bun-repro
bun install
bun start
seunggs commented 2 months ago

Hi, is there any update on this? I'm running into the same issue.

gtrabanco commented 2 months ago

With same example I am seeing this issue:

$ bun build --compile index.ts
6 | import devtools from 'react-devtools-core';
                         ^
error: Could not resolve: "react-devtools-core". Maybe you need to "bun install"?
    at /Users/gtrabanco/MyProjects/bun-5657/node_modules/ink/build/devtools.js:6:22

Bun revision: 1.1.5-canary.1+b257a3097

seunggs commented 2 months ago

I'm seeing that error as well, but it goes away if you bun add react-devtools-core --dev.

marcjfj commented 1 month ago

Anyone find any workarounds for this? This is still an issue on 1.1.10.

marviobezerra commented 3 weeks ago

I'm running 1.1.15 and the issue stills there.

Cannot find module "./yoga.wasm" from "/$bunfs/root/sample-ink"
Kutius commented 2 weeks ago

1.1.17 The same captures this issue

EdamAme-x commented 5 days ago

same

EdamAme-x commented 4 days ago

my workaround

cp ./node_modules/yoga-wasm-web/dist/yoga.wasm ./dist/yoga.wasm