I'm trying to understand how compilation works in Magento 2 with regards to default mode, developer mode, and production mode.

The docs state that auto compilation is enabled in developer mode, which I assume negates the need to run setup:di:compile? In default mode, I'm not sure how compilation is handled. For production mode, I assume you need to re-run setup:di:compile if changes are made for those to materialize?


If you don't run setup:di:compile or clean var/di, DI will work same in all mode. If you run setup:di:compile and enable production mode, DI will get information from compiled files from var/di.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.