[Bug] esbuild.pure strips console.error in production builds #145

Closed
opened 2026-07-17 22:25:38 +00:00 by Mark · 2 comments
Owner

Bug

The Vite config at vite.config.ts sets esbuild.pure: ["console.error"], which strips all console.error() calls from the production bundle. This means every runtime error in production is invisible — no stack traces, no error logging to any monitoring tool, no way for developers to diagnose user-reported crashes.

Impact

  • Any React error boundary catch produces zero diagnostic output
  • Network failures, state corruption, and render crashes go completely silent
  • Users who report "the page broke" cannot be helped because there is no error trail
  • This directly masked the AddPersonDrawer bug (#147) — the JS errors from the broken button click were swallowed with no console output

Location

vite.config.ts line 14-16:

esbuild: {
  pure: ["console.error"],
},

Fix

Remove the esbuild.pure option entirely, or scope it to production builds only and wire a proper error reporting call instead of stripping:

esbuild: {
  pure: process.env.NODE_ENV === 'production' ? [] : ["console.error"],
},

Or better, replace with a dedicated error-reporting service that captures errors without suppressing them entirely.

## Bug The Vite config at `vite.config.ts` sets `esbuild.pure: ["console.error"]`, which strips **all** `console.error()` calls from the production bundle. This means every runtime error in production is invisible — no stack traces, no error logging to any monitoring tool, no way for developers to diagnose user-reported crashes. ## Impact - Any React error boundary catch produces zero diagnostic output - Network failures, state corruption, and render crashes go completely silent - Users who report "the page broke" cannot be helped because there is no error trail - This directly masked the `AddPersonDrawer` bug (#147) — the JS errors from the broken button click were swallowed with no console output ## Location `vite.config.ts` line 14-16: ```ts esbuild: { pure: ["console.error"], }, ``` ## Fix Remove the `esbuild.pure` option entirely, or scope it to production builds only and wire a proper error reporting call instead of stripping: ```ts esbuild: { pure: process.env.NODE_ENV === 'production' ? [] : ["console.error"], }, ``` Or better, replace with a dedicated error-reporting service that captures errors without suppressing them entirely.
Mark 2026-07-24 05:35:59 +00:00
Author
Owner

Already fixed — was removed from vite.config.ts during the lazy-load crash fix. Console errors now visible in dev mode.

Already fixed — was removed from vite.config.ts during the lazy-load crash fix. Console errors now visible in dev mode.
Author
Owner

Already fixed — esbuild.pure was removed from vite.config.ts during the lazy-load crash fix.

Already fixed — esbuild.pure was removed from vite.config.ts during the lazy-load crash fix.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/kimi_agent_kin_app_sync#145
No description provided.