使用 bun create astro
初始化一個新的 Astro 應用程式。create-astro
套件會偵測您是否使用 bunx
,並會自動使用 bun
安裝依賴項。
bun create astro
╭─────╮ Houston:
│ ◠ ◡ ◠ We're glad to have you on board.
╰─────╯
astro v3.1.4 Launch sequence initiated.
dir Where should we create your new project?
./fumbling-field
tmpl How would you like to start your new project?
Use blog template
✔ Template copied
deps Install dependencies?
Yes
✔ Dependencies installed
ts Do you plan to write TypeScript?
Yes
use How strict should TypeScript be?
Strict
✔ TypeScript customized
git Initialize a new git repository?
Yes
✔ Git initialized
next Liftoff confirmed. Explore your project!
Enter your project directory using cd ./fumbling-field
Run `bun run dev` to start the dev server. CTRL+C to stop.
Add frameworks like react or tailwind using astro add.
Stuck? Join us at https://astro.build/chat
╭─────╮ Houston:
│ ◠ ◡ ◠ Good luck out there, astronaut! 🚀
╰─────╯
使用 bunx
啟動開發伺服器。
預設情況下,Bun 會使用 Node.js 執行開發伺服器。若要改用 Bun 執行環境,請使用 --bun
旗標。
bunx --bun astro dev
🚀 astro v3.1.4 started in 200ms
┃ Local https://127.0.0.1:4321/
┃ Network use --host to expose
使用瀏覽器開啟 https://127.0.0.1:4321 以查看結果。當您編輯原始檔時,Astro 會熱重載您的應用程式。
請參閱 Astro 文件 以取得完整的說明文件。