I've seen articles that instruct developers to add docroot/vendor to the .gitignore but if I require a module with composer and push up that module, will that cause a huge error on the site I'm pushing up to?

Does my composer.json file have to include all of the modules in my modules directory?

If I were to copy and paste the composer.json file into another install and run composer install would that automatically give me all of the dependencies I need?

As you can tell, I'm pretty new to Drupal 8. The team I work with uses Acquia and I'm finding a ton of issues when trying come up with a good workflow using compser, drush, git, and config management.


  • Modules still install where they need to with composer if you tell it where to put them
    – Kevin
    Commented May 17, 2018 at 16:16
  • If you’re on Acquia your choices are more simple. Unless you’re using CI (at which point you probably wouldn’t need to this question), you can’t ignore any of the vendor files. They need to be pushed with your repo. See drupal.stackexchange.com/questions/248936/… for some related thoughts
    – Clive
    Commented May 17, 2018 at 16:38
  • Thanks @Clive really helpful. I read so many things that said to ignore it but that's the Drupal world we live in right now it seems.
    – wgallop
    Commented May 17, 2018 at 16:42
  • In an ideal world, yeah, always ignore it and have a deployment server build it for you. The real world is sometimes a tad different of course :)
    – Clive
    Commented May 17, 2018 at 16:45

1 Answer 1


[Assuming you are using composer in this answer]

The vendor directory contains non-Drupal dependencies that core and/or contributes modules require. This is typically fully managed by composer.

The modules directory contains your Drupal modules. It can be managed by composer if you are using drupal-composer/drupal-project or something similar where the install paths can be set.

Committing composer managed dependencies or now, like vendor or modules (if you are doing so), is a nuanced subject. There is no 100% correct answer.

I tend to not commit, even when I am not using a full CI deployment, because the composer dev dependencies should not be deployed on a production server. So, on the live server I want do do a composer install --no-dev.

  • Have you used Composer with Acquia Cloud before?
    – wgallop
    Commented May 17, 2018 at 18:20

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.