Not a whole lot of info out there about this. I understand that bun is in beta at the moment. I just wanted to see where it's at. Remix doesn't really care too much about the runtime since it's tied to standard APIs. However, it's still SSR so ... how to run in prod etc?
bun.sh has the instructions but basically run the curl/bash one-liner command even if you are on zsh
or fish
.
bun --version
0.2.2
You do not need bun to make your remix app.
npx create-remix@latest bun-load-test
Create whatever content you want. In this example, I made a useState counter button example to make it slightly more realistic but oha
isn't going to render JSX. I also put a hardcoded loader function.
// index.tsx
export async function loader() {
const data = [
{ name: "Grass", color: "green" },
{ name: "Air", color: "white" },
{ name: "Fire", color: "red" }
]
return { data }
};
In the JSX ...
<ul>
{elements.data.map((element, i) => {
return (<li key={i}> {element.name} is {element.color}</li>)
})}
</ul>
You probably want to make sure your app works in dev mode or pay attention to oha's error report. We aren't benchmarking 500s here. 😜
bun run build
# Building Remix app in production mode...
# just an example of showing port override
# this is your app server in prod, the last argument is the build directory
# you could put a slash on it to make it clear but not needed
PORT=3001 NODE_ENV=production bun run remix-serve build/
oha --http-version 2.0 -n 10000 -c 10 http://localhost:3001
Summary:
...
Requests/sec: 2702.0305
Latency distribution:
90% in 0.0049 secs
95% in 0.0052 secs
99% in 0.0058 secs
HMR doesn't work. This is really tricky with SSR. :( I didn't exect anything here but you can try anyway: bun run --hot dev