Bun can't bundle `isomorphic-ws`
Opened this issue · 2 comments
grampelberg commented
What version of Bun is running?
1.2.22+6bafe2602
What platform is your computer?
Darwin 25.0.0 arm64 arm
What steps can reproduce the bug?
I've got a repro setup. You can run it with:
bun run serve.tsThen, open your browser and you'll see the error in your console.
What is the expected behavior?
I can use websockets still.
What do you see instead?
browser.js:4 Uncaught Error: ws does not work in the browser. Browser clients must use the native WebSocket object
Additional information
It looks like isomorphic-ws has entry points for node.js and browser.js. When you add an import to isomorphic-ws in the server, it appears that the bundle to also resolve node.js.
RiskyMH commented
It must be doing some degree of caching and as a result using the node one on browser