Don't re-apply patches when requiring new module?

by Mrweiner   Last Updated June 12, 2019 02:07 AM - source

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
    Finished: success: 2, skipped: 0, failure: 0, total: 2
    Finished: success: 2, skipped: 0, failure: 0, total: 2
Using version ^[email protected] 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) 
    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.

Tags : composer patches

Related Questions

Patching .htaccess file

Updated September 20, 2017 12:07 PM