Drupal - Does "composer remove drupal/module" actually uninstall the module first?

No, Composer doesn’t install or uninstall modules in the site itself.

It’s a dependency manager; all it does is compute your requirements, then download them.

You might be able to add a post install/update command to automate it, but trying to make it generic would probably be a pain.


In a Drupal site with a Composer workflow you'll need to do the following when you decide to remove a module:

  1. From your Drupal Admin, uninstall/disable the module so that Drupal doesn't expect to see it.

  2. Edit your composer.json file in the root of your Drupal installation. It should be outside the /web directory. Remove the reference to module module and save the file.

  3. run composer update

Composer will remove the module from the file system and will know that it is no longer a package in the installation.

Tags:

Composer