Search code examples
node.jscontinuous-integrationnext.jseslintvercel

Deploying to Vercel surfaces Next.js errors that I didn't receive during development, how to fix them earlier?


I just started trying to deploy to Vercel recently, and every time I push I have to check the errors during the build, only to find stringent typescript errors or other errors like "Can't use <img> tag, please use next/image" sorts of things. How can I get these errors during development so I don't have to wait til the build step only to find out after a few minutes there is an error, fix it, wait another few minutes, fix the next error, etc. How can I just get all these errors during development, like making it so my app won't compile locally somehow. Right now during development everything compiles fine, just when I push and it goes to Vercel build it starts throwing these errors.

How do I get the errors to display during development, and prevent compilation during npm run dev during development, instead of during npm run build? Also, I would like to be warned in my editor about possible errors in advance if possible, so I can fix them right there before facing them.


Solution

    1. To verify your application will build locally before pushing, you can run next build.
    2. To disable ESLint from failing your build, you can turn it off.