The magento2-base Package

The core codebase of Adobe Commerce consists of a whole host of Composer packages. One of them serves a special function: magento/magento2-base. This package, rather than operating from its source location in vendor like other dependencies, includes a number of important files that are copied into place in the root of the project upon Composer install: the contents of lib, the main app/etc/di.xml file, entry points in pub, etc.

These main project files are often installed initially and then forgotten about, but you do want to make sure you know how you’re dealing with them in your codebase. On the one hand, it might make sense to ignore these locations in source control (although the default .gitigore does not do so). The Composer installation process during deployments should take care of copying the files into place each time.

On the other hand, that’s a long and diverse list of file locations to identify and ignore. Feel free to allow these files to be versioned, but be aware of the implications. If you do eventually have cause to modify one of these files (the main .gitignore is a common one), the original version from magento/magento2-base will be copied into place and overwrite the version under source control upon every fresh Composer install. Get in the habit of excluding such files from the copy process using the project composer.json:

Chris Nanninga

Director of Training and Development at SwiftOtter -@ChrisNanninga