eslint
当在你的项目中检测到 ESLint 时,如果存在错误,Next.js 会使你的 生产构建 (next build
) 失败。
如果你希望 Next.js 即使在你的应用程序存在 ESLint 错误时也生成生产代码,你可以完全禁用内置的 linting 步骤。除非你已经配置了 ESLint 在你的工作流程的另一部分运行(例如,在 CI 或 pre-commit 钩子中),否则不建议这样做。
打开 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,
},
}
这是否有帮助?