FRONTEND_1 Telegram 3958
🔎 Как "убить" ненужный console.log в проде — элегантно

Многие забывают удалять console.log, warn, error перед продом. Это 💩 и баги безопасности, и просто шум. Есть изящное решение — удаление логов на этапе сборки.

Для Vite / Rollup / esbuild / Terser — добавьте:

🔧 Terser (например, в Vite):

// vite.config.ts
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
}


⚙️ Esbuild:

esbuild: {
drop: ['console', 'debugger'],
}


💡 Совет:
Если используете логгер типа logger.info(...), настройте статический анализ через Babel plugin или tree-shaking.

Важно: не отключайте console.error на деве — это может скрыть критичные баги.

🧼 Чистый прод = меньше багов + быстрее загрузка

👉 @frontend_1
👍13



tgoop.com/frontend_1/3958
Create:
Last Update:

🔎 Как "убить" ненужный console.log в проде — элегантно

Многие забывают удалять console.log, warn, error перед продом. Это 💩 и баги безопасности, и просто шум. Есть изящное решение — удаление логов на этапе сборки.

Для Vite / Rollup / esbuild / Terser — добавьте:

🔧 Terser (например, в Vite):


// vite.config.ts
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
}


⚙️ Esbuild:

esbuild: {
drop: ['console', 'debugger'],
}


💡 Совет:
Если используете логгер типа logger.info(...), настройте статический анализ через Babel plugin или tree-shaking.

Важно: не отключайте console.error на деве — это может скрыть критичные баги.

🧼 Чистый прод = меньше багов + быстрее загрузка

👉 @frontend_1

BY Frontend разработчик




Share with your friend now:
tgoop.com/frontend_1/3958

View MORE
Open in Telegram


Telegram News

Date: |

How to create a business channel on Telegram? (Tutorial) The court said the defendant had also incited people to commit public nuisance, with messages calling on them to take part in rallies and demonstrations including at Hong Kong International Airport, to block roads and to paralyse the public transportation system. Various forms of protest promoted on the messaging platform included general strikes, lunchtime protests and silent sit-ins. The creator of the channel becomes its administrator by default. If you need help managing your channel, you can add more administrators from your subscriber base. You can provide each admin with limited or full rights to manage the channel. For example, you can allow an administrator to publish and edit content while withholding the right to add new subscribers. When choosing the right name for your Telegram channel, use the language of your target audience. The name must sum up the essence of your channel in 1-3 words. If you’re planning to expand your Telegram audience, it makes sense to incorporate keywords into your name. “Hey degen, are you stressed? Just let it all out,” he wrote, along with a link to join the group.
from us


Telegram Frontend разработчик
FROM American