ScandiPWA extensions are NPM packages, which are installed as a dependency of a project, which is recognized by ScandiPWA as an extension. Extensions enable developers to ship plug-an-play features of a store (i.e. Social Login, Payment Method). Extensions provide a wide range of extensibility features to modify a default behavior of a store or to add new features to it.
Official ScandiPWA extensions are distributed using marketplace.scandipwa.com. There, developers can download, and install existing extensions (from NPM, or using ZIP) or report issues and request extension development.disable
For an NPM package to be considered an extension, it must have a package.json
field scandipwa.type
equal to extension
. For example:
{
"scandipwa": {
"type": "extension"
}
...
}
<aside>
ℹ️ package.json
is a file that contains relevant and human-readable metadata about the project and specifies a set of dependencies for NPM.
</aside>
Both themes and extensions can register extensions. In order to do it, the extension should be added to scandipwa.extensions
object of package.json
. The extension must be a valid NPM package, therefore you are required to add it into dependencies
field of your package.json
.
{
"dependencies": {
"@scandipwa/m2-theme": "0.0.2",
...
},
"scandipwa": {
"extensions": {
"@scandipwa/m2-theme": true
},
...
}
...
}
Enabling and disabling an extension is achieved by setting the true
or false
as a value of the extension key in scandipwa.extensions
. Your theme can control enabled extensions across the whole application. This allows disabling the previously enabled extension. The sequence of discovering enabled extensions is as follows:
<aside> ⚠️ Watch out! Disabling a previously enabled extension can lead to layout-shifts and issues inside of your parent theme. Also, there might be extensions plugging into the extension you intend to disable, this can lead to unexpected results.
</aside>
The extensions are power-less without a theme. The application compiles from theme sources. Extensions are just isolated pieces, which make some features of your application work. Extensions enable the following extensibility features of ScandiPWA:
This is the recommended way of extension installation. This type of installation prohibits you to modify the package source and enables upgrades via NPM.
This type of installation enables you to modify the package source, but prevents further upgrades.
Please use the following form to report issues or request a new extension from the Marketplace team.
You can use the following command:
extension create
Creates a new scandiPWA extension.
Syntax:
scandipwa extension create [--no-enable] <name>
Options:
-no-enable
will create and install the extension without enabling itname
specifies the name of the new extensionTutorial: Create and register a new extension
Tutorial: Upgrading an extension from 3.x to 4.x
2090