Video yükleniyor...
Video Yüklenemedi
You can remove all console calls from prod in Next.js
146,413 görüntüleme • 1 yıl önce •via X (Twitter)
10 Yorum

Note that it removes all console calls both from the client and the server in prod. You can exclude specific methods if you want to keep them:

One level higher is introducing a `INTERNAL_ENV` environment variable, which is `dev`, `stage` or `prod`. And then you can have the console.log's showing up in staging, but not on production 🚀

shouldn’t your linter handle this? Have a linting job that removes console logs.

Yes! I’ve been doing it all the way from v11. Next is super!

That's super useful. Thank you for the share, Alex

but we test on prod

simple and efficient 🙌

but then how will we debug in prod?

Woah that’s cool. Does that include stdout on the server too?

This is kinda bad for any logging npm packages that override console logging
Benzer Videolar
How to recover from a server component error in Next.js
Alex Sidorenko
67,557 görüntüleme • 1 yıl önce


