What changes when switching between development and production modes?
Switching between the development and production modes automatically changes Webpack's build behavior.
In development mode:
- The code stays readable, without minification
- Source maps are enabled by default (simplifies debugging)
- Fast build, optimizations are disabled or minimal
- Focus on development comfort, not bundle size
In production mode:
- The code is minified (whitespace is removed, variable names are shortened, etc.)
- Tree shaking is enabled (removes unused code)
- CSS and JS are optimized
- Files become smaller
- Caching is improved (
filenamewith hashes is often used) - Source maps are either disabled or hidden
Brief summary:
| Mode | Purpose | Characteristic |
|---|---|---|
development | development | speed and convenience |
production | production | optimization and minimal weight |
By default Webpack enables a set of optimizations depending on the mode, so mode is a switch for the build logic.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.