Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable typescript for failing my builds with nextjs?

Getting a bunch of type errors upon running yarn next build, for example:

Type error: Property 'href' does not exist on type '{ name: string; }'.

Which causes my build to fail. Is there a command i can put in my tsconfig to prevent this from happening?

like image 418
Noob Avatar asked Dec 02 '25 06:12

Noob


2 Answers

From NextJS docs: https://nextjs.org/docs/app/api-reference/config/next-config-js/typescript

Just put this lines in next.config.js under the typescript section:

module.exports = {
  typescript: {
    // !! WARN !!
    // Dangerously allow production builds to successfully complete even if
    // your project has type errors.
    // !! WARN !!
    ignoreBuildErrors: true,
  },
}
like image 79
iba Avatar answered Dec 03 '25 20:12

iba


It's very simple if your facing any kind of prettier or typescript error while doing build so the best and simple way to solve just add this below code in your

next.config.js inside const nextConfig = {}

  eslint: {
    ignoreDuringBuilds: true,
  },
  typescript: {
    ignoreBuildErrors: true,
  },
like image 32
Syed Hazarath Avatar answered Dec 03 '25 19:12

Syed Hazarath



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!