跳至內容

ESLint

當您的專案中偵測到 ESLint 時,如果出現錯誤,Next.js 將會使您的正式版建置 (next build) 失敗。

如果您希望 Next.js 即使在您的應用程式有 ESLint 錯誤時也能產生正式版程式碼,您可以完全停用內建的程式碼檢查步驟。除非您已經設定 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,
  },
}