typescript
Last updated April 15, 2025
Configure TypeScript behavior with thetypescript option innext.config.js:
next.config.js
module.exports= { typescript: { ignoreBuildErrors:false, tsconfigPath:'tsconfig.json', },}Options
| Option | Type | Default | Description |
|---|---|---|---|
ignoreBuildErrors | boolean | false | Allow production builds to complete even with TypeScript errors. |
tsconfigPath | string | 'tsconfig.json' | Path to a customtsconfig.json file. |
ignoreBuildErrors
Next.js fails yourproduction build (next build) when TypeScript errors are present in your project.
If you'd like Next.js to dangerously produce production code even when your application has errors, you can disable the built-in type checking step.
If disabled, be sure you are running type checks as part of your build or deploy process, otherwise this can be very dangerous.
next.config.js
module.exports= { typescript: {// !! WARN !!// Dangerously allow production builds to successfully complete even if// your project has type errors.// !! WARN !! ignoreBuildErrors:true, },}tsconfigPath
Use a different TypeScript configuration file for builds or tooling:
next.config.js
module.exports= { typescript: { tsconfigPath:'tsconfig.build.json', },}See theTypeScript configuration page for more details.
Was this helpful?