What is the best way to make sure kint and devel local debugging modules don't get pushed into other environments?

By toswebdev, 1 February, 2023
What is the best way to make sure kint and devel local debugging modules don't get pushed into other environments?

In Drupal 9 & 10, the best way to make sure that Kint and Devel local debugging modules don't get pushed into other environments is to use the following steps:

  1. Create a separate development environment: Set up a separate environment, such as a local development environment, to install and use Kint and Devel. This will keep these modules separate from other environments such as production or testing environments.
     
  2. Use .gitignore file: Add the modules directory to your .gitignore file so that these modules are not included in your source code repository. This will ensure that the modules are not pushed to other environments.
     
  3. Use a separate repository for development modules: Set up a separate repository for development modules, such as Kint and Devel, and configure your deployment process to only use the production repository in other environments.
     
  4. Use composer exclude-from-classmap: If you are using composer to manage your dependencies, you can use the "exclude-from-classmap" option to exclude the debugging modules from the production environment.
     
  5. 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 this 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

In conclusion, the best way to make sure that Kint and Devel local debugging modules don't get pushed into other environments is to use a different development environment, the .gitignore file, a separate repository for development modules, and the composer "exclude-from-classmap" option. These steps will ensure that these modules are only available in your local development environment and are not pushed to other environments.

Comments

All comments go through moderation, so your comment won't display immediately.