Various Modes in Magento 2
What is Symlink?
A symbolic link (symlink) is a file that points to another file. In Magento 2 developer mode, symlinks are created inside the pub/static directory.
// Symlink locations in Magento 2 (Developer Mode)
pub/static/
pub/static/frontend/
pub/static/adminhtml/
Common issue faced by Developer when working with Knockout JS
// Common Issues:
1. JS/Knockout template changes not updating in frontend.
2. Developer must delete pub/static or run static content deploy every time.
// Checklist:
- Developer mode enabled?
- Is symlink generated in pub/static?
- Browser DevTools → Network → Check "Disable Cache"
A Detailed Discussion on Magento 2 Modes
Magento 2 introduced three main modes:
- Default Mode
- Developer Mode
- Production Mode
And one special mode:
- Maintenance Mode
Default Mode
// Default Mode Features:
- Errors hidden (logged in var/reports)
- Symlinks generated in pub/static
- Not optimized for production
Developer Mode
// Developer Mode Features:
- Shows uncaught errors on browser
- Better debugging + verbose logs
- Automatic code compilation
- Best for development
Production Mode
// Production Mode Features:
- Static files served ONLY from cache
- Errors never shown, only logged
- Highest performance for live store
Setting Magento Modes
php bin/magento deploy:mode:set {mode} [-s|--skip-compilation]
// Examples:
php bin/magento deploy:mode:set developer
php bin/magento deploy:mode:set production --skip-compilation
Clean Cache
php bin/magento cache:clean
See Current Mode
php bin/magento deploy:mode:show
// Example Output:
Current application mode: production