8

In the recent update to Composer 2.0 the advice is to get rid of the wikimedia/composer-merge-plugin, which was even removed from the dependencies of Drupal core.

There is documentation on how to include custom module's composer.json in the root composer.json, for example Managing dependencies for a custom project, but I cannot find documentation on how to include composer.libraries.json in the root composer.json.

Can anyone explain how to get the Webform module compatible with Composer 2.0?

2 Answers 2

1

here is a specific way how to do it for webform module.

  1. run composer require wikimedia/composer-merge-plugin
  2. in composer add
  "merge-plugin": {
            "include": [
                "web/modules/contrib/webform/composer.libraries.json"
            ]
        },
  1. run composer update --lock and verify the files

Reference https://www.drupal.org/docs/8/modules/webform/webform-frequently-asked-questions/how-to-use-composer-to-install-libraries

Reference 2 https://www.drupal.org/docs/8/modules/webform/webform-cookbook/using-the-composer-merge-plugin-to-download-libraries-with

Github issue https://github.com/wikimedia/composer-merge-plugin/issues/184

5
  • 4
    The question seems to explicitly ask for how to not use the wikimedia/composer-merge-plugin.
    – leymannx
    Commented Jan 3, 2021 at 22:45
  • Hi Ales, thank you for the response. Indeed, as Leymannx says the question is how to not use the wikimedia/composer-merge-plugin... So unfortunately your solution does not work. This is how it is implemented now, but not how it should be implemented according to composer 2.0. Commented Jan 4, 2021 at 9:30
  • 2
    As Ales referenced, there is a GitHub issue for Composer Merge Plugin to be compatible with Composer 2, which has been fixed and it now is, so maybe this is the best answer after all.
    – mlncn
    Commented Apr 7, 2021 at 21:19
  • Is it really fixed? In the last comments of the issue there are still people having errors...
    – 0711master
    Commented Jan 30, 2022 at 16:59
  • If your composer update doesn't work to add the dependencies to your lock file, then you can run this command: composer update --with-dependencies
    – DarkteK
    Commented Feb 4, 2023 at 15:34
1

The alternate ways are documented. I think the one you would prefer is:

Execute drush webform:composer:update, to update your Drupal installation's composer.json to include the Webform module's selected libraries as repositories.

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.