更新於 2023/02/17閱讀時間約 1 分鐘

Nuxt 3 安裝與入門

  1. 安裝Node.js
  2. 使用nuxi建立nuxt 3 專案:
$ npx nuxi init hello_nuxt_3
3. 進入專案目錄後,安裝相關套件:
$ npm install
4. 啟動nuxt:
$ npm run dev

  • 跟Nuxt 2用法一樣,新增一個元件放到components資料夾中,可以直接引用:
  • pages用法也一樣,這邊把app.vue改放到pages下,改成index.vue,然後新增一個test page:
  • nuxt.config.ts:
其中紅框的部分是import global local js的方法,這邊無法像global css那樣使用@,綠框vite的部分則是Enable hot reload:
本筆記參考:
  1. https://nuxt.com/docs/getting-started/installation
  2. https://ithelp.ithome.com.tw/articles/10293273
  3. https://github.com/nuxt/nuxt/issues/12662
分享至
成為作者繼續創作的動力吧!
© 2025 vocus All rights reserved.