Here are the main differences between Magento 2 developer and production mode.
Developer mode features:
- PHP stack trace for exceptions is displayed in browser.
- Every XML file that Magento parses is validated against its schema file. So errors can be seen immediately.
- Static assets (images, CSS files, web fonts, JS files) are symlinked on demand to
pub/staticfolder. So that they can be recreated on the fly and accessed by web browser from
pub/staticfolder if these files were previously deleted.
- Debug HTTP headers are added to responses (
- Developer configuration is visible under
Stores -> Configuration -> Advanced -> Developersection in Admin area.
- Debug logging can be enabled under
Stores -> Configuration -> Advanced -> Developer -> Debugsection.
- Static asset minification of JS and CSS files as well as JS bundling cannot be applied in developer mode. Only merging can be applied in developer mode.
Production mode features:
- Static assets are not symlinked or generated on the fly. Magento expects those files to already exist as regular files in
pub/staticfolder after running
bin/magento setup:static-content:deploycommand. If a file is missing, Magento generates 404 error. But since Magento version 2.2.4 there is a configuration setting
'static_content_on_demand_in_production' => 1that can be added to
etc/env.phpfile that allows static assets to be generated on demand in production mode.
- PHP stack trace is hidden in browser. Exceptions can be found in
- Errors in XML files are ignored. No exception is thrown like in developer mode just 404 error can be shown in browser.
- Debug logging is always disabled in production mode.
Stores -> Configuration -> Advanced -> Developersection is hidden in Admin area in production mode. So minification or merging is not available in Admin.
- Caching cannot be disabled in production mode under
System -> Cache Managementgrid in Admin area. But it can be disabled/enabled via console.