diff --git a/src/ImposterPlugin.php b/src/ImposterPlugin.php
index <HASH>..<HASH> 100644
--- a/src/ImposterPlugin.php
+++ b/src/ImposterPlugin.php
@@ -7,6 +7,7 @@ namespace TypistTech\Imposter\Plugin;
 use Composer\Composer;
 use Composer\EventDispatcher\EventSubscriberInterface;
 use Composer\IO\IOInterface;
+use Composer\Package\CompletePackage;
 use Composer\Package\RootPackageInterface;
 use Composer\Plugin\PluginInterface;
 use Composer\Script\Event;
@@ -23,6 +24,19 @@ class ImposterPlugin implements PluginInterface, EventSubscriberInterface
         if ($package instanceof RootPackageInterface) {
             AutoloadMerger::run($package);
         }
+
+        if ($package instanceof CompletePackage) {
+            $scripts = array_merge_recursive([
+                ScriptEvents::POST_INSTALL_CMD => [
+                    '@composer dump-autoload --optimize',
+                ],
+                ScriptEvents::POST_UPDATE_CMD => [
+                    '@composer dump-autoload --optimize',
+                ],
+            ], $package->getScripts());
+
+            $package->setScripts($scripts);
+        }
     }
 
     /**
Run `composer dump-autoload --optimize` after composer update and composer install