#how do i prevent eslint typescript errors on a folder and stop it from blocking builds on vercel
1 messages · Page 1 of 1 (latest)
Hi @pseudo terrace. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
To prevent ESLint and TypeScript errors from blocking your builds on Vercel, you can configure your Next.js project to ignore these errors during the build process. This is especially useful when working with external tools like Sanity where you might have schema files that trigger linting or type errors but don't affect your application's functionality.
Disabling TypeScript Errors
You can disable TypeScript error checking during builds by adding the following to your next.config.js file:
module.exports = {
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
}
This will allow your builds to complete successfully even when TypeScript errors are present in your project Next.js TypeScript Configuration.
Disabling ESLint During Builds
Similarly, you can disable ESLint checks during the build process by adding this to your next.config.js:
module.exports = {
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
}
This will prevent ESLint errors from blocking your builds Next.js ESLint Configuration.
Combined Configuration
You can combine both configurations in your next.config.js file:
module.exports = {
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
}
This approach is mentioned in the Next.js documentation for optimizing memory usage Next.js Memory Usage Optimization.
Important Considerations
While this will allow your builds to complete with errors, it's generally recommended to:
- Run type checks and linting as part of your development workflow or in a separate CI step
- Only use these options when necessary, as they can lead to issues in production if actual problems are ignored
- Consider setting up a staging deployment workflow where you can verify everything works before promoting to production
Remember that disabling these checks means you're bypassing important safeguards, so use these options judiciously.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@pseudo terrace Kapa.ai is still learning and improving, please let me know how I did by reacting below.