oven-sh / bun

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

react-bootstrap and `bun build` not playing together #7709

Open keverw opened 10 months ago

keverw commented 10 months ago

What version of Bun is running?

1.0.18+36c316a24

What platform is your computer?

Darwin 23.2.0 arm64 arm

What steps can reproduce the bug?

When trying to use it directly such as server side rendering, no errors but when trying to bundle it (to either target Bun or Browser) you get Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

bun run index.tsx and visit the server, no error.

Then bun build index.tsx --target=bun --outdir ./foo and run the output index.js and visit the server, you would see the error.

I made a little minimum demo if it helps:

bun-react-bootstrap.zip

What is the expected behavior?

It would work as expected without an error.

What do you see instead?

AN error indicating that perhaps mixing named and default imports.

Additional information

Others mentioned this issue in the React-Bootstrap library https://github.com/react-bootstrap/react-bootstrap/issues/6717 - so if that helps gives any more context linking it. Considering it works in Node/Parcel it was recommended to file the issue here instead.

keverw commented 9 months ago

I noticed this is working Bun 1.0.21, so looks like this can be closed unless I'm experiencing an anomaly. Not sure what might have fixed it though.