Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

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

Alex Sidorenko profil fotoğrafı
Alex Sidorenko1 yıl önce

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:

Ninio profil fotoğrafı
Ninio1 yıl önce

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 🚀

Prakhar Shukla profil fotoğrafı
Prakhar Shukla1 yıl önce

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

Malvin 🇬🇭 profil fotoğrafı
Malvin 🇬🇭1 yıl önce

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

Prasenjit profil fotoğrafı
Prasenjit1 yıl önce

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

pankaj profil fotoğrafı
pankaj1 yıl önce

but we test on prod

Adil - medusa/acc - oss/acc profil fotoğrafı
Adil - medusa/acc - oss/acc1 yıl önce

simple and efficient 🙌

⅃ ℺ ℇ 💀 profil fotoğrafı
⅃ ℺ ℇ 💀1 yıl önce

but then how will we debug in prod?

Frank Flitton profil fotoğrafı
Frank Flitton1 yıl önce

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

Jordan Hall profil fotoğrafı
Jordan Hall1 yıl önce

This is kinda bad for any logging npm packages that override console logging

Benzer Videolar