We have the following composer.json file. When we want to update a module such as Environment Indicator, we run the suggested composer command composer require drupal/environment_indicator:^3.7'.

In doing so it also applies the patches for core and other modules because the patches is defined in our composer.json file.

What we tried this as well but it had the same results.

composer update drupal/environment_indicator --with-dependencies


    "name": "drupal/drupal",
    "description": "Drupal is an open source content management platform powering millions of websites and applications.",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "require": {
        "composer/installers": "^1.0.24",
        "drupal/core" : "^8.6",
        "wikimedia/composer-merge-plugin": "^1.4"
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "preferred-install": "dist",
        "autoloader-suffix": "Drupal8"
    "extra": {
        "_readme": [
            "By default Drupal loads the autoloader from ./vendor/autoload.php.",
            "To change the autoloader you can edit ./autoload.php.",
            "This file specifies the packages.drupal.org repository.",
            "You can read more about this composer repository at:",
        "merge-plugin": {
            "include": [
            "recurse": true,
            "replace": false,
            "merge-extra": false
        "installer-paths": {
            "core": ["type:drupal-core"],
            "modules/contrib/{$name}": ["type:drupal-module"],
            "profiles/contrib/{$name}": ["type:drupal-profile"],
            "themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"],
            "modules/custom/{$name}": ["type:drupal-custom-module"],
            "themes/custom/{$name}": ["type:drupal-custom-theme"]
        "enable-patching": true,
        "patches" : {
            "drupal/core": {
               "issuenumber1" : "path/to/patch.patch",
            "drupal/eck": {
               "issuenumber2" : "path/to/patch.patch",

1 Answer 1


Unfortunately, composer is always going to apply any patches you have defined that are not already applied whenever it runs. You can comment out the patches, run your composer command, and then uncomment them.

  • 1
    What is the point of commenting out patches and putting it back, though? I am not sure if this is the full picture of the question, because I can require a new module just fine without any previously applied patches being applied again.
    – Kevin
    Sep 12, 2019 at 21:21
  • 1
    I mean, what is the point of having patches defined in composer but not wanting them applied? He asked how to do it, they way I suggested would work. Sep 12, 2019 at 21:25
  • @IsaiahNixon It sounds like you are saying there is not way to do it without commenting out? I did think about doing that, but that did not seem like a sustainable way to do it since the goal is to apply a patch for a single module when that module is updated, rather than apply to all modules. Sep 26, 2019 at 21:56
  • @usernameabc From what I can tell, composer will always make sure the patches defined in your composer.json are applied every time you run an install or update. If you do not want certain patches applied, you need to remove them (or comment them out) from your composer.json. Out of curiosity, why do you have patches defined that you do not want applied? Sep 26, 2019 at 22:07

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.