ScandiPWA (deprecated)
User ManualGitHubSlack
  • ScandiPWA (deprecated)
  • React & PWA for dummies
    • Setting Up Environment and Talking Theory
    • Learning React Hands-on
    • Styling It
    • Learning ScandiPWA Way
  • START & UPGRADE
    • Linux Docker setup
    • Mac Docker setup
    • Setting up the theme with remote M2 server
    • Theme Upgrade to the latest version
    • Automated setup (BETA)
  • A TO Z OVERVIEW
    • Motivation
    • Challenges
    • File structure and UI components
    • Rewriting and Extending A Theme
  • DESCRIPTION OF CONTAINERS
    • Ngrok
  • FAQ
    • Development
    • Installation
    • Billing and license
    • Product support
    • What is PWA?
  • HOW-TO TUTORIALS - INTRODUCTORY
    • Base template
    • Connecting to the GraphQL resolver
    • Extension mechanism
    • Creating GraphQL resolver
    • Debugging and Inspecting
    • Setting Up Frontend
    • File Structure
    • Data Flow
    • Technology Stack
    • Changing environment
    • Theme Build and Configuration
    • Implementing Caching for New Caching Identities
    • Implementing a parent theme
  • HOW-TO TUTORIALS - INTERMEDIATE
    • Debugging in Chrome
    • Configuring XDebug
    • CLI in Docker
    • Postman & GraphQL Playground
    • VSCode Extensions
    • Plugins: implementing
    • Plugins: using and publishing
    • ESlint & StyleLint
    • How To Contribute
    • Migrating to a Newer Version
    • Installation on Existing Magento 2 Sever
    • BEM and Coding Standards
    • Tools of ScandiPWA
    • React Best Practices
  • FAQ
    • Untitled
Powered by GitBook
On this page
  • While using this setup:
  • Before you start
  • Time to decide - core or custom?
  • For ScandiPWA core contribution
  • For custom theme development
  • Time to open the site
  • Something does not work?
  1. START & UPGRADE

Setting up the theme with remote M2 server

PreviousMac Docker setupNextTheme Upgrade to the latest version

Last updated 4 years ago

While using this setup:

  1. ScandiPWA theme is run by wepack-dev-server

  2. All /graphql requests are sent to your remote server

  3. There is an Nginx routing the requests

Note:

it is impossible to test the website in production mode (of the webpack build). This is the main downside of this approach.

Note:

the https://scandipwa.local wont be available. The PWA features will not function.

In code examples, you might stumble across such declaration:

# to clone the fork
git clone git@github.com:<YOUR GITHUB USERNAME>/scandipwa-base.git

Note:

the <YOUR GITHUB USERNAME> is not a literal text to keep, but the “template” to replace with the real value.

Before you start

  1. If you plan to make changes to the theme make sure to , or into existing one.

    1. Make sure you have a SSH key assigned to your GitHub account, and you current machine has the same key. Read .

    2. Make sure to fork . Read .

  2. Make sure your remote server has ScandiPWA installed on it

    The Magento theme could be different, but ScandiPWA modules should be installed and enabled. Read more how to install the ScandiPWA on existing Magento 2 server .

    In case you do not have the ScandiPWA instance yet, try completing this setup using our instances: demo.scandipwa.com or scandipwapmrev.indvp.com. You can also request your own cloud instance by composing a mail to hello@scandipwa.com.

  3. Make sure you have node available on you machine. To test this, run:

node -v # should be 10^

Time to decide - core or custom?

The theme can be developed in two modes - as contribution into core theme, or as custom theme development on top of core theme. Let’s review each one:

For ScandiPWA core contribution

  1. Get the copy of base-theme - clone your fork, or clone the original repository.

# to clone the fork
git clone git@github.com:<YOUR GITHUB USERNAME>/base-theme.git

# to clone the original repository
git clone git@github.com:scandipwa/base-theme.git

# to clone via HTTPS (not recommended)
git clone https://github.com/scandipwa/base-theme.git

Note:

sometimes, after the repository is cloned, the git chooses the master branch as default. This is the legacy (incorrect) default branch in case of base-theme. Please make sure you are using 3.x-stable. You can do it using following command:

git status # expected output `On branch 3.x-stable`

If any other output has been returned, execute the following command to checkout the correct branch:

git checkout 3.x-stable

Later, for development purposes any new branch created from 3.x-stable can be used.

2. Add following key to package.json:

{
    // ...
    "proxy": "https://demo.scandipwa.com"
}

Note:

Do not commit this change, if planning to use with docker.

3. From the cloned theme folder, execute following:

npm ci # install dependencies
npm run watch-core

For custom theme development

Note:

initial setup must happen on real instance. After the bootstrapped theme is committed to the repository, you can proceed with this installation

  1. Inside, clone your already bootstrapped scandipwa-base package with theme already bootstrapped. The theme file should be present in <REPO SOURCE>/src/app/design/frontend/<VENDOR>/<THEME>/.

git clone <CUSTOM THEME REPOSITORY GIT REMOTE>
mkdir -p src/vendor/scandipwa/source
git clone git@github.com:scandipwa/base-theme.git src/vendor/scandipwa/source

3. Add following key to package.json, located in your theme’s folder (<REPO SOURCE>/src/app/design/frontend/<VENDOR>/<THEME>/package.json):

{
    // ...
    "proxy": "https://demo.scandipwa.com"
}

Note:

Do not commit this change, if planning to use with docker.

4. From the custom theme theme folder, execute following:

npm ci # install dependencies
npm run watch

Time to open the site

  1. Open your favorite browser, i.e. Google Chrome

Note:

in case you are getting CORS issues printed out in console, make sure to run chrome with disabled web-security flag set.

Something does not work?

Follow this simple algorithm:

Note:

the Docker setup related issues are also mentioned in this document.

In case this command resulted in error, install node using the . Prefer nvm installation to get NODE version 10 specifically.

2. Then, get matching scandipwa/source package version from (lookup the required version in src/composer.lock, lookup scandipwa/source package) and clone it to vendor folder. Make sure the folder is present.

Open un-secure domain

Refer to the . It most probably already has the solution to your problem.

If the issue still persists, , and feel free to ask questions in #pwa_tech public channel.

Alternatively - however, the response time there will be a little-bit longer than in community Slack.

create GitHub account
sign in
how to setup SSH key on GitHub
scandipwa-base repository
how to fork repository on GitHub
here
official guide
GitHub
localhost:3003
FAQ page
join our community slack
create an issue on GitHub