4

Maybe this is a very silly question. I can not understand why I must run the command setup:di:compile every time I make changes to custom modules, to see the results when I am in developer mode.

Can it be disabled?

1
  • Sounds like you have cache enabled. as you shouldn't be required to do anything to get your changes to show. the only reason you would need to empty generated is if the constructors have changed in any way. Commented Jan 27, 2021 at 16:43

2 Answers 2

10

You don't need to run it. You can simply delete the directories under var/generation (or under generated/ after 2.2). Be careful not to the delete the .htaccess file. You only really ever need to do this when you create a new constructor or change or reorder the arguments being passed into one of your class constructors.

For 2.2 and onwards, Magento documentation suggests using this command:

rm -rf <magento_root>/generated/metadata/* <magento_root>/generated/code/*
5

You should not run setup:di:compile in developer mode!

This command need only for production mode.

2
  • But if don't run it I can't see some changes I make to my custom extension. For example, when I add a new class to my module, it is not recognized until I run setup:di:compile. What am I doing wrong?
    – giani.sim
    Commented Oct 1, 2016 at 17:47
  • 1
    try cleanup var/di and var/generate folder and try one more time
    – KAndy
    Commented Oct 1, 2016 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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