#Using bun on remix
1 messages · Page 1 of 1 (latest)
That's not a Remix error, but TS error
if you check Bun docs, you need a TS plugin
after you install @types/bun you will have TS know that Bun is a thing
remember that you also need to use Bun as runtime, not just to install packages
Oh I'm sorry, I forgot to install it, thankyou @remote junco
I've installed @types/bun and show an error Bun is not defined
you have to import it into the file probably?
Just to be sure, you’re running the remix project using bun? As in you have a custom server and you’re running it with bun
Error: Cannot find package 'bun' imported from /<my-project-directory>/build/index.js
Yes, but I not using the custom server
Then you cannot use bun
Remix server will call node under the hood
You need to specify a custom server and how to run it to use bun
I create remix project from https://bun.sh/guides/ecosystem/remix
Yes, sadly the bun team has some pretty poor guides and most of them either require you to have node for the project to work still, or don’t understand the project it’s running well enough to know that it’s incorrect. In remix’s case in particular the remix dev command calls “node server.js” so now your runtime switches back to a node instance
I’ve had a pretty poor time using buns guides because what I said where they don’t seem to have done a real deep dive on the thing they write a simple guide for, so they don’t realize if it works or not properly. Basically all that bun guide does for you is calls create-remix through bun since create-remix is an npm executable. And then bun run dev calls remix dev where remix calls node under the hood
That’s using Bun as runtime
I've adjusting some files (server.ts, entry.server.ts, package.json) according to your code examples, but I got this error
Part of a remix custom server needs to specify how to fetch statically built files that remix produces. Make sure your remix files are being built into the public/build folder. And that your static file server is finding those files properly. To me it looks like Sergio’s example has his public build located outside of the actual github public but maybe there’s some different fil targeting going on there. But Sergio’s server says “if i can’t find a static file of the name requested then send the request to remix” but it seems like your server isn’t finding the built files so it sends the request to remix and remix doesn’t see a route for that file