React Bundling Corruption: The Terser Trap
โ Cannot read properties of undefined (reading 'ReactCurrentDispatcher')
๐ Symptoms
- โธReact errors in production console
- โธApp working locally but broken on Netlify
- โธReactCurrentBatchConfig undefined errors
๐ฏ Root Cause
Overly aggressive Terser minification with 3 compression passes was corrupting React's internal structure. Combined with disabled code splitting, React and ReactDOM were being minified together into one bundle.
โ Solution
Reduced Terser to single pass, removed pure_getters and side_effects flags, enabled proper code splitting with separate vendor chunks for React, ReactDOM, and other libraries.
โ Clean 200 OK status, no console errors, proper chunk separation (React: 50KB, ReactDOM: 265KB)