1

When we work in di.xml file for extend the functionality then we need to php bin/magento setup:di:compile setup:di:compile take 30 to 40 second or long in window. if we remove the generation folder/files then it equal to run setup:di:compile or not ? kindly clear it because i read this in Magento 2 Book. if rm -f var/generation then it save time. I think it necessary to know for all beginner like me

  • 1
    If you are on production mode and you have removed generated/ then you have to run setup:di:compile. Because on production mode compiled and static files are not generated automatically unlike developer or default mode. – Ramkishan Suthar Mar 4 '19 at 13:22
1

yes, if you just run di:compile command, then it will override you current generated folder, it will delete all previous files and create new one.

But your directory need to have permission to delete through command, and also if files are currently in used (Through browser or anywhere else) it will show you error. But most of the time it will just delete old files and create new one in generated.

I got issues in my localhost, it will not delete files in generated, and shows error, but on my server (Ubuntu) it will work perfectly, so, I don't need to delete generated directory before running command

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.