TransWikia.com

Magento2 : How to setup PWA in Localhost?

Magento Asked by Sanjay Jethva on December 6, 2021

I want to setup PWA in localhost. I have tried in localhost but at last its giving dynamic staging server URL like below

https://magento-venia.local.pwadev:51828/

How can we change it to our localhost server URL.

3 Answers

alright you just need to update .env for variable CUSTOM_ORIGIN_EXACT_DOMAIN

 # vi .env
 # update value 
   CUSTOM_ORIGIN_EXACT_DOMAIN="pwa.dev"
 # now run 
   yarn buildpack create-custom-origin ./
 # Acquired custom hostname and SSL cert for pwa.dev. Development server will run on port 8626 and staging server will run on port 9626
 # Run server again
   yarn watch 
 # Project is running at https://pwa.dev:8626/

Official pwa setup guide And Create custom origin guide

let me know if this works

Answered by rex on December 6, 2021

Magento 2.3.1 PWA setup on local server

Requirements:

Nodejs > 10.14.1 installed

yarn > 1.13.0 installed

A running instance of Magento 2.3.1 or above

Steps to Setup PWA in local server

  • Clone the PWA studio repository in the development environment: git clone https://github.com/magento-research/pwa-studio.git

  • Install yarn from your pwa-studio root directory yarn install

  • Create the .env file at location pwa-studiopackagesvenia-concept using following command

    MAGENTO_BACKEND_URL="https://master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud/" yarn buildpack create-env-file packages/venia-concept

  • Set the MAGENTO_BACKEND_URL. You can use the value provided in the example command or use your Magento instance url. This URL points to a cloud instance of Magento 2.3.1 with the Venia sample data installed.

  • Generate SSL Certificate using yarn buildpack create-custom-origin packages/venia-concept

  • Build artifacts for Venia using the following command from the project root directory

    yarn run build

  • Start the Venia development environment using the following command

    yarn run watch:venia

  • You can browse your PWA Magneto application at https://magento-venia-concept-j2188.local.pwadev:8119

Hope this solution will work for you.

Answered by Mitali on December 6, 2021

If you checked the steps and results from PWA documentation: https://magento-research.github.io/pwa-studio/venia-pwa-concept/setup/ you will see that actually you got the local dev URL for your PWA development server. Check to add that URL to your hosts file in case that is not working for your setup.

Answered by Ezequiel Alba on December 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP