You might want to install ScandiPWA as a Magento theme – and this is supported out of the box! You can install the theme as a local composer module, continuously build it, and Magento will be able to recognize it as a valid Magento theme. Then, you will be able to select your ScandiPWA-based theme in the Magento configuration.
Make sure your server is running Magento
2.3.4 is not supported. Make sure your server is configured to point into
<MAGENTO ROOT>/pub directory.
node -v # should be 10^
varnishd -V # should be 5^
In Magento admin go to Stores > Configuration > Advanced > System > Full Page Cache. Make sure the
Varnish Cache is selected in the dropdown, varnish configuration has proper values set in it.
If it is not, please follow official documentation to set it up.
redis-cli -v # should output 2.5^
If it is not installed, please follow this guide to obtain it.
We recommend you keep your theme source in a
src/localmodules directory. You will then be able to configure composer to install the theme from here as a local module.
mkdir src/localmodulescd src/localmodules
Run the compilation process in magento mode:
BUILD_MODE=magento yarn start
BUILD_MODE=magento npm start
Now the new theme is created, but we need to install it using composer. The changes we need are easiest to make from within the docker container, so start the app and gain
bash access to it:
From the project rootdc up -dinapp bash # to enter the app container
We will install the newly-created theme by taking advantage of Composer's ability to install from local repository sources. First, we add our theme as a local repository source. This will alter
composer.json to add a new item in the
(from within the app container)composer config repo.theme path localmodules/<your-app-name>
Next, we install our theme by using
require. This will resolve the package to the localmodules directory we configured above:
(from within the app container)composer require scandipwa/<your-app-name>
upgrade command and disable full-page caching:
(from within the app container)bin/magento setup:upgradebin/magento cache:disable full_page
It is now time to enable the new theme. In the Magento admin panel, navigate to Content > Design > Configuration. Edit the scope you want to change (typically the most general one in the list), and select the new theme. Finally, flush the cache:
(from within the app container)bin/magento cache:flush