Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable TypeScript from checking types validity when building for production

I am using using Next.js with TypeScript for a small project. I am wondering if it's possible to disable types validity checks when I run npm run build considering type checking happened during npm run dev. Plus this will help to build production build without TypeScript package which is not used in production.

like image 579
Muteshi Avatar asked Nov 25 '25 09:11

Muteshi


1 Answers

Open next.config.js and enable the ignoreBuildErrors option in the typescript config:

module.exports = {
  typescript: {
    // !! WARN !!
    // Dangerously allow production builds to successfully complete even if
    // your project has type errors.
    // !! WARN !!
    ignoreBuildErrors: true,
  },
}

More info on the docs: https://nextjs.org/docs/api-reference/next.config.js/ignoring-typescript-errors

like image 147
buondevid Avatar answered Nov 28 '25 02:11

buondevid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!