This is a React project bootstrapped with bun.
bun create react ./react-bun-app
First, run the development server.
bun dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying src/App.jsx. The page auto-updates as you edit the file.
Add react-scripts
to devDependencies
:
bun add react-scripts -d
Build locally to add browserslist
to package.json
:
bun react-scripts build
make sure to connect your repo to github and netlify to enable automatic builds.
ntl init
Edit netlify.toml
:
[build]
# custom build command that install bun and run build
command = "./scripts/build.sh"
# CRA output folder
publish = "build"
[build.environment]
# disable NPM install
NPM_FLAGS = "--version"
Edit scripts/build.sh
:
#!/bin/bash
set -e
curl -fsSL https://bun.sh/install | bash
export PATH="/opt/buildhome/.bun/bin:$PATH"
bun --version
bun install
bun react-scripts build
Just push to github and netlify will build and deploy your site.
- How to build production build of Bun React
- How to install Bun
- Install Deno on Netlify --- we use the same idea to install Bun
- How to disable NPM install