I Built My First NPM Library: no-console-production



This content originally appeared on DEV Community and was authored by Harpreet Singh

As a developer, I was tired of shipping apps full of console.logs. Debugging locally is fine, but in production it looks messy, unprofessional, and sometimes even risky. So I built my first open-source package to fix it.

💡 Meet no-console-production
🔗 NPM Package: https://www.npmjs.com/package/no-console-production

A lightweight library (~2KB) that automatically hides console logs in production while keeping errors visible for monitoring.

✨ Features

🛡 Smart defaults — detects environment, hides logs/warnings, preserves errors.

⚛ React-ready — hooks + providers for easy integration.

🎯 Developer-friendly — TypeScript support, granular control, fast, tiny bundle.

🔧 Flexible — suppress all methods or just specific ones.

📦 NPM: no-console-production

🚀 Why it matters

Cleaner, more professional apps

Better performance (no useless console ops)

Reduced risk of leaking sensitive data

🙏 First OSS Contribution

This is my first open-source project and it taught me a lot about npm publishing, TypeScript libraries, and performance optimization. I’d love your feedback:

⭐ Star the repo

🐛 Report issues

💡 Suggest features

Your support will help me grow as a developer and improve this tool for everyone!


This content originally appeared on DEV Community and was authored by Harpreet Singh