Search code examples
shopwareshopware6

Is the order of the bundles/apps/plugins inside the generated file var/plugins.json in Shopware 6 important?


When developing store bundles/apps/plugins in Shopware 6, the file var/plugins.json often has to be generated since it is needed for the build scripts, for example bin/build-administration.sh in the Shopware 6 production template.

Depending on the branch that is being worked on, different bundles/apps/plugins are active. The file var/plugins.json is of course different in each branch, but the order of contents is constantly changing since the bundle:dump command has no integrated sorting which leads to repeated merge conflicts similarly to the composer.lock file, since the order of items changes most of the time.

A possible solution is to ksort the array of bundles/apps/plugins before it gets written into var/plugins.json. However, I'm wondering if this could lead to problems, for example should one plugin be dependent on another. So my question is: Is the order of the bundles inside the generated file var/plugins.json in Shopware 6 important?


Solution

  • The plugins are sorted ascending by the date stored in plugin.installed_at. This affects the order of template inheritance within plugins for example, so generally speaking it matters. Within the plugins.json however I'm not exactly sure if it does though, since it seems to be used by the webpack.config.js for injecting a possible custom webpack config of a plugin, which I think should not come in conflict with each other no matter what the order is.