Magento 2 — Module — __construct Method Updates

Once you update your __construct method, a lot of developers do bin/magento setup:di:compile. You don’t have to do this actually, you only need to delete all files inside generated directory but .htaccess by running this command :

rm -rf generated/*

Then go get to your browser, and refresh. Voila you get your __contruct changes.

It’s only working on developer mode. On production or default mode, you still have to do bin/magento setup:di:compile for every changes you make.

I wrote these tutorials for myself in future when I forget for the next steps.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store