跳至內容

輸出目錄 (distDir)

您可以指定一個名稱來取代 .next 作為自定義建置目錄。

開啟 next.config.js 並加入 distDir 設定

next.config.js
module.exports = {
  distDir: 'build',
}

現在,如果您執行 next build,Next.js 將會使用 build 資料夾來取代預設的 .next 資料夾。

distDir 不應設定在專案目錄之外。例如,../build 就是一個 無效的 目錄。