Install the Open Source metapackage
While PWA uses the standard GraphQL workflow, the metapackage adds capabilities for some PWA Studio features.
You must install this metapackage in all projects using PWA Studio 12.1.0 and higher.
Installation as a git-based composer package
To set up and develop your PWA extension modules locally, use the following instructions.
Clone the
magento2-pwa
repository into yourvendor
directory name:Copied to your clipboardgit clone git@github.com:magento/magento2-pwa.git ext/magento/magento2-pwaUpdate the
magento2/composer.json
settings to create a better development workflow for your extension modules:Update the
minimum-stability
for packages todev
. This allows for the installation of development modules:Copied to your clipboardcomposer config minimum-stability devTo work with
stable
packages, ensure that theprefer-stable
property istrue
. This property should already be included in thecomposer.json
file, right above theminimum-stability
setting.Configure
composer
to find new extension modules. The following command configurescomposer
to treat any extension code inside theext
directory as a package and creates a symlink to thevendor
directory:Copied to your clipboardcomposer config repositories.ext path "./vendor/ext/*/*/*"
Install the
pwa
metapackage:Copied to your clipboardcomposer require magento/pwa
At this point, you should see symlinks for all the pwa
modules inside the vendor
directory. These symlinks allow you to:
- Run a Magento installation with additional modules.
- Develop locally using the standard git workflow.
Make sure that all of the required modules are enabled when you run bin/magento module:status
. See, Enable or disable a component in the PHP Developer Guide for instructions.
The following modules should now be enabled:
Copied to your clipboardMagento_EavGraphQlAuxMagento_CatalogGraphQlAuxMagento_SalesGraphQlAuxMagento_WeeeGraphQlAuxMagento_ContactGraphQlPwaMagento_NewsletterGraphQlPwaMagento_PageBuilderPwaMagento_ReCaptchaGraphQlPwaMagento_ReCaptchaPwaMagento_UrlRewriteGraphQlPwa
Setting up the Git workflow
To improve the developer experience even further, you can add these configurations as well:
Exclude all the
ext
directories in the project's.git
configuration:Copied to your clipboardecho ext >> ./.git/info/excludeSkip your project's root directory
composer.\*
files to avoid committing them by mistake:Copied to your clipboardgit update-index --skip-worktree composer.json && git update-index --skip-worktree composer.lockNOTE: You can reverse this operation anytime as needed:
Copied to your clipboardgit update-index --no-skip-worktree composer.json && git update-index --no-skip-worktree composer.lock
Cloud deployment extension installation
Add https://repo.magento.com as a composer repository by adding the following to the
composer.json
file of your cloud instances.Copied to your clipboard"repositories": {"repo": {"type": "composer","url": "https://repo.magento.com"}},Require the
magento/pwa
extension by adding the following to thecomposer.json
file of your cloud instances.Copied to your clipboard"require": {"magento/pwa": "0.2.1"},Ensure your
auth.json
file has valid credentials forrepo.magento.com
.Run
composer update
to update yourcomposer.lock
file.Push the changes and deploy your cloud instance.