This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Oxc
- @vitejs/plugin-react-swc uses SWC
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the TS template for information on how to integrate TypeScript and Oxlint's TypeScript related rules in your project.
This project is configured for Cloudflare Pages with SPA client routing (_redirects), security & caching rules (_headers), and Wrangler settings (wrangler.jsonc).
- In Cloudflare Dashboard, go to Workers & Pages > Create application > Pages > Connect to Git.
- Select this repository.
- Configure build settings:
- Framework preset:
Vite - Build command:
npm run build - Build output directory:
dist
- Framework preset:
- Click Save and Deploy.
# Preview locally with Wrangler
npm run preview:cf
# Deploy to Cloudflare Pages
npm run deploy:cfA GitHub Actions workflow is provided at .github/workflows/cloudflare-pages.yml. To enable automated deployments:
- In your GitHub repository settings, add secrets:
CLOUDFLARE_API_TOKENCLOUDFLARE_ACCOUNT_ID
- Pushes to
mainwill automatically build and deploy.