Closed5
Bunを使ってのNext.js+shadcn/ui環境構築備忘録
前述
筆者は、Homebrewを使ってBunをインストールしている。
Bunのバージョンは1.0.11
👆 大体のことはここに書いてある。
npx
。bunx
で利用できる。
Initialize Next.js
bun create next-app
✔ What is your project named? … bun-next-shadcn
✔ Would you like to use TypeScript? … No / Yes
✔ Would you like to use ESLint? … No / Yes
✔ Would you like to use Tailwind CSS? … No / Yes
✔ Would you like to use `src/` directory? … No / Yes
✔ Would you like to use App Router? (recommended) … No / Yes
✔ Would you like to customize the default import alias? … No / Yes
✔ What import alias would you like configured? … @/*
Initialize shadcn UI
bunx shadcn-ui init
✔ Would you like to use TypeScript (recommended)? … no / yes
✔ Which style would you like to use? › Default
✔ Which color would you like to use as base color? › Stone
✔ Where is your global CSS file? … app/globals.css
✔ Would you like to use CSS variables for colors? … no / yes
✔ Where is your tailwind.config.js located? … tailwind.config.js
✔ Configure the import alias for components: … @/components
✔ Configure the import alias for utils: … @/lib/utils
✔ Are you using React Server Components? … no / yes
✔ Write configuration to components.json. Proceed? … yes
Install shadcn UI / Button(Sample)
bunx shadcn-ui@latest add button
bun.lockb
Created rm -rf package-lock.json node_modules
bun install
Run local server
bun --bun run dev
bun --bun run dev
$ next dev
▲ Next.js 14.0.2
- Local: http://localhost:3000
✓ Ready in NaNms
○ Compiling / ...
✓ Compiled / in 3.9s (496 modules)
✓ Compiled in 2.9s (237 modules)
○ Compiling /not-found ...
✓ Compiled /not-found in 1131ms (487 modules)
bun run dev
bun run dev
$ next dev
▲ Next.js 14.0.2
- Local: http://localhost:3000
✓ Ready in 2.7s
○ Compiling / ...
✓ Compiled / in 2.1s (496 modules)
✓ Compiled in 504ms (237 modules)
✓ Compiled /favicon.ico in 386ms (510 modules)
✓ Compiled /not-found in 193ms (515 modules)
このスクラップは2023/11/13にクローズされました