Drupal 8.8 introduced a new setting: https://www.drupal.org/node/3079028

By adding these lines to your settings.local.php I expected the modules and their configuration to be excluded from config export.

$settings['config_exclude_modules'] = ['kint', 'devel'];


  • kint and devel still appear in my core.extensions.yml
  • Yaml files related to devel still get generated.
  • Modules are still removed and installed based on the core.extensions.yml

How does this feature work?

Edit: I upgraded from Drupal 8.7, that seems to keep this function to work properly.

  • 3
    Does this answer your question? How to prevent Devel module to be installed on production environments – leymannx Mar 3 '20 at 10:51
  • 3
    I'd recommend Configuration Split. See drupal.stackexchange.com/a/264358/15055 how. – leymannx Mar 3 '20 at 10:53
  • 3
    I know about configuration split, but I want to know how this feature works, because it is in drupal core. Now it seems to do nothing. Maybe I do something wrong. drush cex --skip-modules seems not to do anything either. Maybe it is removed from drush 9. – Erlend ter Maat Mar 3 '20 at 14:21
  • 1
    Stupid question: Did you ensure your settings.local.php gets included correctly from settings.php in all environments? – leymannx Mar 3 '20 at 14:32
  • 1
    I created a drush script with this line of code: dump(Drupal::service('settings')->get('config_exclude_modules')); It shows that the content of this setting is as expected. – Erlend ter Maat Mar 3 '20 at 21:39

Enable the module and activate the filter by declaring $settings['config_exclude_modules'] in your settings.php file, eg:

$settings['config_exclude_modules'] = ['devel', 'stage_file_proxy'];

Now, when you export configuration (drush config-export), the selected modules should no longer show up in core.extension.yml and their configuration should not be exported.

Make sure first before doing that to remove these module from core.extensions.yml manually for the first time.

Update: It seems to be related to a drush issues: drush config:status does not respect excluded modules #4194

  • 2
    When I do so, after I do drush config-export it overwrites core.extensions.yml. When I remove them and do drush config-import it uninstalls the devel and stage_file_proxy module. – Erlend ter Maat Mar 12 '20 at 9:38
  • 1
    It works as expected for fresh installations of Drupal 8.8 – Erlend ter Maat Mar 12 '20 at 20:30
  • 1
    It did not work out well for my upgraded 8.7 to 8.8 install, but it makes sense to first remove the yml files. Else errors show you the way to what yaml files you should remove to make it work. – Erlend ter Maat Mar 16 '20 at 11:49

I'm on Drupal 8.9.2 and this does not work.

I have $settings['config_exclude_modules'] = ['stage_file_proxy']; in my settings.php.

I've removed the module from the core.extension.yml file but when I run drush cex it pops straight back in there. When I run drush cim if the module line is removed from core.extension.yml drupal then tries to uninstall it from the local site.

Is there any other way of specifying what modules should exist in which environment?

Edit: Confirmed - this feature does not work: https://www.drupal.org/project/drupal/issues/3102435#comment-13580861

Edit 2: It does work but needs Drush 10! I got it working with Drupal 8.9.2 and drush 10.3.1

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.