I keep running into the issue that, when requiring a new module with composer, existing packages are removed and reinstalled if they have patches defined in composer.json. For instance,

λ lando composer require drupal/media_entity_browser
    1/2:        https://packages.drupal.org/8/drupal/provider-2019-2$bae9fca7243956d61e44a716bdfb5c872f0f3e1a0b48b1dccfcae53d7e59c86f.json 
    2/2:        https://packages.drupal.org/8/drupal/provider-2019-1$25356ca628b704d49a0ea504e6374f921a2b54d845d142aae1708cb94088516f.json 
    Finished: success: 2, skipped: 0, failure: 0, total: 2
    1/2:        http://repo.packagist.org/p/provider-latest$56447e2294826167894155c32ceb596c58b3b2af059facd78694060f8a4d8c1c.json 
    2/2:        http://repo.packagist.org/p/provider-2019-04$a612146345a708aa360ee61a695dd52d8d0faa79e136de5e075c95860af7c956.json 
    Finished: success: 2, skipped: 0, failure: 0, total: 2
Using version ^1.0@beta for drupal/media_entity_browser 
./composer.json has been updated 
Gathering patches for root package. 
Removing package drupal/core so that it can be re-installed and re-patched. 
  - Removing drupal/core (8.7.3)
Deleting web/core - deleted 
> DrupalProject\composer\ScriptHandler::checkComposerVersion 
Loading composer repositories with package information 
Updating dependencies (including require-dev) 
    1/4:        https://ftp.drupal.org/files/projects/media_entity-8.x-1.8.zip 
    2/4:        https://ftp.drupal.org/files/projects/entity-8.x-1.0-rc3.zip 
    3/4:        https://ftp.drupal.org/files/projects/entity_browser-8.x-2.1.zip 
    4/4:        https://ftp.drupal.org/files/projects/media_entity_browser-8.x-1.0-beta3.zip 
    Finished: success: 4, skipped: 0, failure: 0, total: 4
Package operations: 5 installs, 0 updates, 0 removals 
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute

For something like drupal/core this is really a problem on my local as it takes a while to download and reinstall the package. I can't seem to find a pattern. Sometimes it seems that the repatched package is a requirement of the one being required, other times they are unrelated or no packages are repatched at all.

Has anybody else come across this? Is there a way around it? Ideally we'd only re-apply patches to a package when it's updated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.