This is a React application built using Bun and Vite.
- React is a JavaScript library for building user interfaces.
- Bun is a fast all-in-one JavaScript runtime, package manager, and more.
- Vite is a build tool that aims to provide a faster and leaner development experience for modern web projects
tool | usage in this project | |
---|---|---|
Bun | package manager, scaffolding | |
Vite | build, dev server |
-
Install Bun
curl -fsSL https://bun.sh/install | bash
-
Scaffold the React application with
bun create react .
-
Install Vite with React plugin
bun add -d vite @vitejs/plugin-react
-
Move
index.html
to rootmv public/index.html .
-
Create Vite config
vite.config.ts
import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' export default defineConfig({ base: '/react-bun-vite/' plugins: [ react() ] })
-
Build with Vite
bun vite build
We can serve the React app locally using Vite or Bun:
- Run the Vite development server
bun vite dev
. http://localhost:5174 - Run the Bun development server
bun dev
http://localhost:3000
Preview the production build locally with Vite bun vite preview
. http://localhost:4173
This application is deployed to GitHub Pages using a GitHub Actions workflow.