When first running app, error appear for missing modules: "aws-sdk", "nock", "mock-aws-s3"
.
After installing them using npm, app runs normally but after opening it through the preview link, in the editor console many errors appear along the lines of Vite Error: optimized info should be defined
. Sometimes other errors appear in the brower's console Uncaught ReferenceError: global is not defined at ../../node_modules/buffer/index.js
and Websocket closed before establishing
.
These are my package.json
files:
// shopify-app-examples/qr-code/node/package.json
{
"name": "qr-code-sample-app",
"version": "0.1.0",
"main": "web/index.js",
"license": "UNLICENSED",
"scripts": {
"shopify": "shopify",
"build": "shopify app build",
"dev": "shopify app dev",
"push": "shopify app push",
"scaffold": "shopify app scaffold",
"deploy": "shopify app deploy"
},
"dependencies": {
"@shopify/app": "^3.21.0",
"@shopify/checkout-ui-extensions-react": "^0.24.0",
"@shopify/cli": "^3.21.0",
"axios": "^1.3.4",
"firebase": "^9.17.2",
"react": "17.0.2",
"sqlite3": "^5.0.8"
},
"author": "Shopify",
"devDependencies": {
"@types/sqlite3": "^3.1.8"
}
}
// shopify-app-examples/qr-code/node/web/package.json
{
"name": "shopify-app-template-node",
"private": true,
"license": "UNLICENSED",
"scripts": {
"debug": "node --inspect-brk index.js",
"dev": "cross-env NODE_ENV=development nodemon index.js --ignore ./frontend",
"serve": "cross-env NODE_ENV=production node index.js"
},
"type": "module",
"engines": {
"node": ">=14.13.1"
},
"dependencies": {
"@shopify/shopify-app-express": "^1.0.0",
"@shopify/shopify-app-session-storage-sqlite": "^1.0.0",
"compression": "^1.7.4",
"cross-env": "^7.0.3",
"qrcode": "^1.5.0",
"serve-static": "^1.14.1"
},
"devDependencies": {
"jsonwebtoken": "^8.5.1",
"nodemon": "^2.0.15",
"prettier": "^2.6.2",
"pretty-quick": "^3.1.3"
}
}
// shopify-app-examples/qr-code/node/web/frontend/package.json
{
"name": "shopify-frontend-template-react",
"private": true,
"license": "UNLICENSED",
"scripts": {
"build": "vite build",
"dev": "vite",
"coverage": "vitest run --coverage"
},
"type": "module",
"engines": {
"node": ">= 12.16"
},
"dependencies": {
"@shopify/app-bridge": "^3.1.0",
"@shopify/app-bridge-react": "^3.1.0",
"@shopify/app-bridge-utils": "^3.1.0",
"@shopify/polaris": "^9.11.0",
"@shopify/react-form": "^2.4.1",
"@shopify/react-hooks": "^3.0.2",
"@vitejs/plugin-react": "1.2.0",
"dayjs": "^1.11.6",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-query": "^3.34.19",
"react-router-dom": "^6.3.0",
"vite": "^2.8.6"
},
"devDependencies": {
"history": "^5.3.0",
"jsdom": "^19.0.0",
"prettier": "^2.6.0",
"vi-fetch": "^0.6.1"
}
}