Stop getting new build errors in production
When I use
pnpm dev
I get no errors, and the page loads and works perfectly, when I pushed it to production I keep getting lots of different errors, how can I make it so I only get the errors I get in dev?Solution:Jump to solution
Think about what you're experiencing, and how to troubleshoot it.
First step is to diagnose the problem. Your app in production doesn't match your app in development. Why? The shortcut to that question is -> the way you push to production isn't the same way you start your dev server (
pnpm dev
). So, the answer is to follow the steps the production deployment takes to find the problem. The next shortcut I'll give you is run pnpm build
and you'll probably have errors on your machine too. Probably with the Webpack configuration or some other build tool. Once you start duplicating the production errors on your machine, you can adjust your config files to correct the errors.
Note that once you get it building without errors locally the production server might still need adjustments to its setup such as environment vars or other settings....4 Replies
Solution
Think about what you're experiencing, and how to troubleshoot it.
First step is to diagnose the problem. Your app in production doesn't match your app in development. Why? The shortcut to that question is -> the way you push to production isn't the same way you start your dev server (
pnpm dev
). So, the answer is to follow the steps the production deployment takes to find the problem. The next shortcut I'll give you is run pnpm build
and you'll probably have errors on your machine too. Probably with the Webpack configuration or some other build tool. Once you start duplicating the production errors on your machine, you can adjust your config files to correct the errors.
Note that once you get it building without errors locally the production server might still need adjustments to its setup such as environment vars or other settings.I was looking for
however am marking your answer correct as it is the one that I think most people will be looking for. Thanks for trying to help
Oh! Those errors! 😬
I think those ignores should be part of every t3 example app and cli jumpstart. There are far too many cases where code lacks the determinism or specificity during early stages to get types defined for a successful build until you can get the right types defined and eslint- or ts-ignores in place.
But thanks for the solved mark. 🙏
Yeah, I have filled an issue on create t3 app to at least get it as an option for development. One of the problems was an
route.ts
file with a req.json
so obviously that will always prevent compiling without casting it etc.