There are three deployment mode is available in Magento 2.
How to check which mode is enabled?
We check the currently enabled mode by running the below Magento command.
php bin/magento deploy:mode:show
It is a Magento default mode, once we switched from default mode to other modes, we can’t come back to default mode again by command line.
Better choice for development work
Exception is visible in the browser
XML files are validated against their schema and display errors in the browser
Symlinks are enabled from the original source to pub/static. So if the static files are not found in the location, Magento will automatically generated from the original(extension/theme) source on the fly
X-Magento-Cache-* Headers are only available in developer mode
Admin -> Store -> configuration -> Advanced -> Developer This option is only available in developer mode
JS, CSS minification and JS bundling is not work in development mode
php bin/mageto setup:static-content:deploy is not work(necessary), we can add -f to forcefully generate static content in developer mode
We can enable debug log
If we change require-config.js, it will automatically merge into the pub/static/…require-config.js
No symlinks are created from source to static assets (pub/static). If Magento is not found static assets, it won’t generate on the fly. We need to run static content deployment again to generate missing files. We can enable the symlink (on demand generation) of static content in production mode by adding below line app/etc/env.php
‘static_content_on_demand_in_production’ => 1,
Errors are not displaying in the browser. It will display the error report file number, we need to check that in the location of var/report for the detailed report.
XML validation errors are ignored and it won’t be displayed in the browser.
Debug log is in disabled mode even if it is enabled in developer mode. Always, debug log is disabled in the production mode.
Admin -> Store -> configuration -> Advanced -> Developer This option is not available in the production mode.
We can’t disable cache from admin. We need to use magento command for enable/disable cache in production mode.
X-Magento-Cache* is not available
If we change require-config.js, it will not automatically merge into the pub/static/…require-config.js, we need generate static content to reflect the changes.