[Runtime
](../../../index.md)[Package Manager
](../../../pm/cli/install/index.md)[Bundler
](../../../bundler/index.md)[Test Runner
](../../../test/index.md)[Guides
](../../index.md)[Reference
](https://bun.com/reference)[Blog
](https://bun.com/blog)[Feedback
](../../../feedback/index.md)
You can use Vite with Bun, but many projects get faster builds & drop hundreds of dependencies by switching to HTML imports.
Vite works out of the box with Bun. Get started with one of Vite’s templates.
terminal
bun create vite my-app
✔ Select a framework: › React
✔ Select a variant: › TypeScript + SWC
Scaffolding project in /path/to/my-app...
Then cd into the project directory and install dependencies.
terminal
cd my-app
bun install
Start the development server with the vite CLI using bunx. The --bun flag tells Bun to run Vite’s CLI using bun instead of node; by default Bun respects Vite’s #!/usr/bin/env node shebang line.
terminal
bunx --bun vite
To simplify this command, update the "dev" script in package.json to the following.
package.json
"scripts": {
"dev": "vite",
"dev": "bunx --bun vite",
"build": "vite build",
"serve": "vite preview"
},
// ...
Now you can start the development server with bun run dev.
terminal
bun run dev
The following command will build your app for production.
terminal
bunx --bun vite build
This is a stripped down guide to get you started with Vite + Bun. For more information, see the Vite documentation.
Was this page helpful?
[
Run Bun as a daemon with systemd
Previous
](../systemd/index.md)[
Bun Redis with Upstash
Next
](../upstash/index.md)