ScandiPWA
Create Magento AppCreate ScandiPWA AppUser ManualGitHub
  • Why Scandi
  • πŸš€Quick-start Guide
  • πŸ—ΊοΈRoadmap
  • Introduction to the Stack
    • CMA, CSA, and ScandiPWA
    • Challenges
  • Setting up Scandi
    • Storefront Mode Setup
      • Proxying requests to server
    • Magento Mode Setup
    • Existing Magento 2 setup
    • Magento Commerce Cloud setup
    • Updating to new releases
      • Storefront mode upgrade
      • Magento mode upgrade
      • CMA upgrade
      • CSA upgrade
      • Custom ScandiPWA composer dependency update
      • Local ScandiPWA Composer Package Setup
    • Docker Setup [deprecated]
      • Legacy Docker setup
      • Migrating to CMA & CSA
  • Developing with Scandi
    • Override Mechanism
      • Overriding JavaScript
        • Overriding classes
        • Overriding non-classes
      • Overriding Styles
      • Overriding the HTML / PHP
      • Parent Themes
    • Extensions
      • Creating an extension
      • Installing an extension
      • Migrating from 3.x to 4.x
      • Publishing an extension
      • Extension Terminology
    • Working With Magento
      • Magento troubleshooting
      • Working with Magento modules
      • Working with GraphQL
      • GraphQL Security
      • Working with "granular cache"
    • Developer Tools
      • Debugging in VSCode
      • ScandiPWA CLI
      • Configuring ESLint
      • CSA Commands
    • Deploying Your App
      • Build & Deploy Android app
      • Build & Deploy iOS app
  • Structure
    • Directory Structure
    • Building Blocks
      • Components
        • Styling Components
      • Routes
      • Redux Stores
      • GraphQL Queries
      • Global Styles
      • The Util Directory
      • Type Checking
    • Application assets
    • Code Style
      • JavaScript Code Style
      • SCSS Code Style
  • Tutorials
    • Customizing Your Theme
      • Styling
        • Customizing the Global Styles
        • Adding a New Font
        • Overriding a Components Styles
        • Extending a Component's Styles
      • Customizing JavaScript
        • Customizing the Footer Copyright
        • Adding a New Page
        • Adding a Section in My Account
        • Adding a Tab on the Product Page
        • Creating a New Redux Store
    • Payment Method Integration
      • Setting Up for Development
      • Redirecting to the Payment Provider
      • Handling the Customer's Return
    • Creating a Custom Widget
      • Scandi CMS System Overview
      • Creating a Magento Widget
      • Implementing the Rendering
    • Video Tutorials
      • #1 Setting up and talking theory
      • #2 Templating in React
      • #3 Overriding a file
      • #4 Styling the application
      • #5 Patterns of ScandiPWA
    • Dark Mode Extension
    • Deploying Native Apps
    • Product 3D Model Extension
      • Part 1: Magento 3D Model Uploads
      • Part 2: GraphQL API
      • Part 3: Scandi Frontend
    • Social Share, Full Extension Development
      • STEP-1 and 2 Creating Magento 2 Module
      • STEP-3 Backend Configurations Settings
      • STEP-4 Simple GraphQl and Resolver
      • STEP-5 Creating Extension, Base Redux Store
      • STEP-6 Extension plugins
      • STEP-7 GraphQL types, Helpers
      • STEP-8 Query Field and FieldList
      • STEP-9 render Plugins and MSTP Plugin, Component creation
      • STEP-10 SocialShare Component Development
      • STEP-11 SocialShare for CategoryPage
      • TASK-1 Changing LinkedIn to Twitter
      • STEP-12 Comments for Admin Users
      • STEP-13 Final, bugfixes
    • Accessing Magento 2 Controllers
      • STEP-1 Creating Magento 2 Module
      • STEP-2 - Create Magento 2 Frontend Route and Basic Controller
      • STEP-3 Accessing Magento 2 Controller, Bypassing ScandiPWA frontend
      • STEP-4 Creating ScandiPWA Extension with additional dependencies
      • STEP-5 Creating Plugin and Axios request
  • About
    • Support
    • Release notes
    • Technical Information
    • Data Analytics
    • Contributing
      • Installation from Fork
      • Repository structure
      • Code contribution process
      • Submitting an Issue
      • Publishing ScandiPWA
Powered by GitBook
On this page
  • Registering an extension
  • Enabling an extension
  • Extension features

Was this helpful?

  1. Developing with Scandi
  2. Extensions

Creating an extension

For NPM package to be considered an extension, it must have a package.json field scandipwa.type equal to extension. For example:

{
    "scandipwa": {
        "type": "extension"
    }
    ...
}

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.

Any package containing the @namespace magic comments must have a scandipwa block declared in its package.json file. Otherwise, the @namespace magic comments will not be handled correctly during the build time, hence will not work.

Registering an extension

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. Like so:

{
    "dependencies": {
        "@scandipwa/m2-theme": "0.0.2",
        ...
    },
    "scandipwa": {
        "extensions": {
            "@scandipwa/m2-theme": true
        },
        ...
    }
    ...
}
scandipwa extension install <PACKAGE>

In order to create a new extension, use the following command:

scandipwa extension create <PACKAGE>

This command will create a new extension in the packages folder and register it in your current theme. It will be symlinked from packages to proper folder under node_modules.

Enabling an extension

Enabling and disabling an extension is achieved by setting the trueor 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 preference in this case is:

  1. Your theme enabled extensions

  2. Your theme's parent themes enabled extensions

  3. Extension enabled extensions

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.

Extension features

Extensions are a very important part of the ScandiPWA tool-chain. The following features are available:

PreviousExtensionsNextInstalling an extension

Last updated 4 years ago

Was this helpful?

This process could be automated using . First, make sure you are in your theme's root folder. Now, to install an extension from the NPM registry, you can use the following command:

​​

​​

​​

​

ScandiPWA CLI
Application plugins
Build configuration plugins
Module preference
File provision
Translation bundles