Загрузка видео...

Не удалось загрузить видео

На главную

You can remove all console calls from prod in Next.js

146,413 просмотров • 1 год назад •via X (Twitter)

Комментарии: 10

Фото профиля Alex Sidorenko
Alex Sidorenko1 год назад

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
Ninio1 год назад

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
Prakhar Shukla1 год назад

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

Фото профиля Malvin 🇬🇭
Malvin 🇬🇭1 год назад

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

Фото профиля Prasenjit
Prasenjit1 год назад

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

Фото профиля pankaj
pankaj1 год назад

but we test on prod

Фото профиля Adil - medusa/acc - oss/acc
Adil - medusa/acc - oss/acc1 год назад

simple and efficient 🙌

Фото профиля ⅃ ℺ ℇ 💀
⅃ ℺ ℇ 💀1 год назад

but then how will we debug in prod?

Фото профиля Frank Flitton
Frank Flitton1 год назад

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

Фото профиля Jordan Hall
Jordan Hall1 год назад

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

Похожие видео