Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Uncaught ReferenceError: Buffer is not defined #74

Open
jenschr opened this issue Jan 10, 2023 · 1 comment
Open

Uncaught ReferenceError: Buffer is not defined #74

jenschr opened this issue Jan 10, 2023 · 1 comment

Comments

@jenschr
Copy link

jenschr commented Jan 10, 2023

Right now, every newly created example will fail to run in the browser, with the above error. This seems to be related to an import referenced in this issue, but I just can't seem to locate it in the code of "
mqtt-react-hooks". Also mentioned in this issue, so many MQTT libs have this problem right now.

To reproduce the issue:

Can reproduce every time. Some suggest to solve this by downgrading "react-script", but that's not a real fix and causes other problems.

package.json contents:

{
  "name": "mqtt-demo-react",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "mqtt-react-hooks": "^3.0.0-alpha.2",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "5.0.1",
    "url": "^0.11.0",
    "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"
    ]
  }
}

@haisamMH
Copy link

haisamMH commented Mar 2, 2023

Any solutions would be appreciated!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants