eslint
当在你的项目中检测到 ESLint 时,如果存在错误,Next.js 将会使你的生产构建 (next build
) 失败。
如果你希望即使你的应用程序存在 ESLint 错误,Next.js 也能生成生产代码,你可以完全禁用内置的 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,
},
}
这有帮助吗?