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



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: |

On Tuesday, some local media outlets included Sing Tao Daily cited sources as saying the Hong Kong government was considering restricting access to Telegram. Privacy Commissioner for Personal Data Ada Chung told to the Legislative Council on Monday that government officials, police and lawmakers remain the targets of “doxxing” despite a privacy law amendment last year that criminalised the malicious disclosure of personal information. As the broader market downturn continues, yelling online has become the crypto trader’s latest coping mechanism after the rise of Goblintown Ethereum NFTs at the end of May and beginning of June, where holders made incoherent groaning sounds and role-played as urine-loving goblin creatures in late-night Twitter Spaces. The SUCK Channel on Telegram, with a message saying some content has been removed by the police. Photo: Telegram screenshot. Click “Save” ; As of Thursday, the SUCK Channel had 34,146 subscribers, with only one message dated August 28, 2020. It was an announcement stating that police had removed all posts on the channel because its content “contravenes the laws of Hong Kong.”
from us


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