Shopify/shopify-frontend-template-react

Building Frontend With SHOPIFY_API_KEY

muhammad-hunnain786 opened this issue · 1 comments

Issue summary

it is necessary to set SHOPIFY_API_KEY while building frontend with npm run build using following command

cd web/frontend/ && SHOPIFY_API_KEY=REPLACE_ME npm run build

but i getting error below

'SHOPIFY_API_KEY' is not recognized as an internal or external command, operable program or batch file.

Expected behavior

it should build the app with the SHOPIFY_API_KEY so it can work on frontend

Specifications

  • Browser: chrome
  • Device: dell
  • Operating System: windows 11

If you're trying to run build from within the frontend folder, you could try and edit the "build" command within /web/frontend/package.json

Old: "build": "vite build"
New: "build": "SHOPIFY_API_KEY=REPLACE_ME vite build"

So your command would become cd web/frontend/ && npm run build