Skip to content

Bun supporta i file .jsx e .tsx out of the box. React funziona semplicemente con Bun.

Crea una nuova app React con bun init --react. Questo ti fornisce un template con una semplice app React e un semplice server API insieme in un'unica app full-stack.

bash
# Crea una nuova app React
bun init --react

# Esegui l'app in modalità sviluppo
bun dev

# Costruisci come sito statico per la produzione
bun run build

# Esegui il server in produzione
bun start

Hot Reloading

Esegui bun dev per avviare l'app in modalità sviluppo. Questo avvierà il server API e l'app React con hot reloading.

App Full-Stack

Esegui bun start per avviare il server API e il frontend insieme in un unico processo.

Sito Statico

Esegui bun run build per costruire l'app come sito statico. Questo creerà una directory dist con l'app costruita e tutte le risorse.

txt
├── src/
│   ├── index.tsx       # Punto di ingresso del server con rotte API
│   ├── frontend.tsx    # Punto di ingresso dell'app React con HMR
│   ├── App.tsx         # Componente React principale
│   ├── APITester.tsx   # Componente per testare gli endpoint API
│   ├── index.html      # Template HTML
│   ├── index.css       # Stili
│   └── *.svg           # Risorse statiche
├── package.json        # Dipendenze e script
├── tsconfig.json       # Configurazione TypeScript
├── bunfig.toml         # Configurazione Bun
└── bun.lock            # File di lock

Bun a cura di www.bunjs.com.cn