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,
},
}
這有幫助嗎?