teintinu / pix-react

QRCode para pagamento PIX / QRCode for Brazilian PIX payment
https://codesandbox.io/embed/kind-dubinsky-mxc81?fontsize=14&hidenavigation=1&theme=dark&view=preview
GNU General Public License v3.0
13 stars 5 forks source link

Qrcode appears once, and after that, the message "Buffer is not defined" #2

Open altobellibm opened 2 years ago

altobellibm commented 2 years ago

Qrcode appears once, and after that, the message "Buffer is not defined"

i'm using react with typescript template

follow my package.json file:

_``` { "name": "pix-react-test", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^5.16.4", "@testing-library/react": "^12.1.4", "@testing-library/user-event": "^13.5.0", "@types/jest": "^27.4.1", "@types/node": "^16.11.26", "@types/react": "^17.0.44", "@types/react-dom": "^17.0.15", "buffer": "^6.0.3", "pix-react": "^1.0.3", "react": "^18.0.0", "react-dom": "^18.0.0", "react-scripts": "5.0.0", "typescript": "^4.6.3", "web-vitals": "^2.1.4" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } }

gugacarbo commented 2 years ago

Tive o mesmo problema, mas esse código resolveu import * as buffer from "buffer"; window.Buffer = buffer.Buffer;

AdrienneMota commented 1 year ago

https://rodriguesabner1.medium.com/pix-qrcode-din%C3%A2mico-usando-reactjs-f449bc015d7d

image