跳到主要內容

eslint

當您的專案中偵測到 ESLint 時,如果存在錯誤,Next.js 會讓您的生產建置 (next build) 失敗。

如果您希望 Next.js 即使在您的應用程式有 ESLint 錯誤時仍產生生產程式碼,您可以完全停用內建的 linting 步驟。除非您已經設定 ESLint 在工作流程的另一個部分執行(例如,在 CI 或 pre-commit hook 中),否則不建議這樣做。

開啟 next.config.js 並在 eslint 設定中啟用 ignoreDuringBuilds 選項

next.config.js
module.exports = {
  eslint: {
    // Warning: This allows production builds to successfully complete even if
    // your project has ESLint errors.
    ignoreDuringBuilds: true,
  },
}