#Use Bun even when compatibility is a problem
1 messages · Page 1 of 1 (latest)
the answer to your question is it vastly depends on a case-by-case basis depending on what the actual cause of the problem
https://github.com/oven-sh/bun/issues/2996
@pseudo cairn narrowed the bug down to this. thanks for reporting.
i tried using bun build --target=bun on jimp but it didnt seem to work
thats your best bet since bun build does the cjs+esm interop stuff different than the runtime
its also quite anoying to have an extra build step but if it works you're stuck with that for now.
the way that bun handles commonjs + es modules
in this case it mistakingly thinks one of jimps' es modules is a commonjs module (since it extends the event emitter class). thats a bug in bun
bun build is a javascript bundler that will bundle a file and all of its dependencies into one file
you can use it like bun build --target=bun index.ts --outfile=bundle.js where that imports jimp and your other app code
then you can run bun bundle.js to run it
yeah