Bun

指南生態系統

使用 Qwik 和 Bun 建立應用程式

使用 bunx create-qwik 初始化新的 Qwik 應用程式。

create-qwik 套件會偵測您是否使用 bunx,並會自動使用 bun 安裝相依性。

bun create qwik

      ............
    .::: :--------:.
   .::::  .:-------:.
  .:::::.   .:-------.
  ::::::.     .:------.
 ::::::.        :-----:
 ::::::.       .:-----.
  :::::::.     .-----.
   ::::::::..   ---:.
    .:::::::::. :-:.
     ..::::::::::::
             ...::::


┌  Let's create a  Qwik App  ✨ (v1.2.10)

◇  Where would you like to create your new project? (Use '.' or './' for current directory)
│  ./my-app

●  Creating new project in  /path/to/my-app  ... 🐇

◇  Select a starter
│  Basic App

◇  Would you like to install bun dependencies?
│  Yes

◇  Initialize a new git repository?
│  No

◇  Finishing the install. Wanna hear a joke?
│  Yes

○  ────────────────────────────────────────────────────────╮
│                                                          │
│  How do you know if there’s an elephant under your bed?  │
│  Your head hits the ceiling!                             │
│                                                          │
├──────────────────────────────────────────────────────────╯

◇  App Created 🐰

◇  Installed bun dependencies 📋

○  Result ─────────────────────────────────────────────╮
│                                                      │
│  Success!  Project created in my-app directory       │
│                                                      │
│  Integrations? Add Netlify, Cloudflare, Tailwind...  │
│  bun qwik add                                        │
│                                                      │
│  Relevant docs:                                      │
│  https://qwik.dev.org.tw/docs/getting-started/       │
│                                                      │
│  Questions? Start the conversation at:               │
│  https://qwik.dev.org.tw/chat                        │
│  https://twitter.com/QwikDev                         │
│                                                      │
│  Presentations, Podcasts and Videos:                 │
│  https://qwik.dev.org.tw/media/                      │
│                                                      │
│  Next steps:                                         │
│  cd my-app                                           │
│  bun start                                           │
│                                                      │
│                                                      │
├──────────────────────────────────────────────────────╯

└  Happy coding! 🎉

執行 bun run dev 以啟動開發伺服器。

bun run dev
  $ vite--mode ssr

  VITE v4.4.7  ready in 1190 ms

  ➜  Local:   https://127.0.0.1:5173/
  ➜  Network: use --host to expose
  ➜  press h to show help

使用瀏覽器開啟 https://127.0.0.1:5173 以查看結果。當您編輯原始檔時,Qwik 會熱重載您的應用程式。

Qwik screenshot

請參閱 Qwik 文件 以取得完整的說明文件。