box icon indicating copy to clipboard operation
box copied to clipboard

fix: Fix compilation of projects using dev composer plugins

Open theofidry opened this issue 2 years ago • 1 comments

Closes #580

Related https://github.com/composer/composer/issues/11325.

The problem is that dump-autoload does not really care about the --dev|--no-dev flag. It looks like it only cares about it for the actual dumped autoload, but before that, i.e. when autoloading the code, it does not and instead just loads everything that is registered in installed.json|installed.php.

The way Box works is:

  • copy the source code
  • remove dev deps (inferred via the composer json/lock files but it is done directly, not via Composer)
  • dump the autoload

This means that if you have a dev plugin, e.g. phpstan/extension-installer, when dumping the autoload, the plugin will be attempted to be loaded. This of course cannot work since it's a dev dep and Box removed it.

I think this could be solved in Composer, but I also cannot just wait for a fix there so I'll likely need to temper the content of installed.json & installed.php

theofidry avatar Feb 13 '23 23:02 theofidry

Related https://github.com/composer/composer/issues/11325

theofidry avatar Feb 26 '23 18:02 theofidry