正在加载视频...
视频加载失败
You can remove all console calls from prod in Next.js
10 条评论

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
相关视频
Alex Jones calls for the 25th Amendment to remove Trump from office
Headquarters
2,245,714 次观看 • 3 个月前


