#Using bun on remix

1 messages · Page 1 of 1 (latest)

woven obsidian
#

How to use Bun utilities like Bun.env, Bun.password and etc in Remix?

remote junco
#

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

woven obsidian
#

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

thick estuary
#

you have to import it into the file probably?

coral flax
woven obsidian
woven obsidian
coral flax
#

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

woven obsidian
coral flax
#

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

remote junco
#

That’s using Bun as runtime

woven obsidian
coral flax
#

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