onfleet / node-onfleet

Onfleet API wrapper in NodeJS
MIT License
18 stars 18 forks source link

[BUG] BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default #72

Open Johny8811 opened 2 years ago

Johny8811 commented 2 years ago

Describe the bug I installed node-onfleet module, created an Onfleet object, run the app and got error: BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

To Reproduce Steps to reproduce the behavior:

  1. install node-onfleet module
  2. create basic Onfleet object
  3. run the app

Expected behavior Should work normally

Screenshots

Screenshot 2022-07-29

Additional context I used basic create-react-app cli

{
  "private": true,
  "dependencies": {
    "@date-io/date-fns": "^2.14.0",
    "@emotion/react": "^11.9.3",
    "@emotion/styled": "^11.9.3",
    "@mui/icons-material": "^5.8.4",
    "@mui/material": "^5.8.6",
    "@mui/x-data-grid": "^5.12.3",
    "@mui/x-date-pickers": "^5.0.0-alpha.7",
    "@onfleet/node-onfleet": "^1.3.1",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^13.0.0",
    "@testing-library/user-event": "^13.2.1",
    "@types/jest": "^27.0.1",
    "@types/node": "^16.7.13",
    "@types/onfleet__node-onfleet": "^1.2.3",
    "@types/react": "^18.0.0",
    "@types/react-dom": "^18.0.0",
    "date-fns": "^2.28.0",
    "firebase": "^9.8.4",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "6",
    "react-scripts": "5.0.1",
    "typescript": "^4.4.2",
    "web-vitals": "^2.1.0",
    "xlsx": "https://cdn.sheetjs.com/xlsx-0.18.9/xlsx-0.18.9.tgz"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "lint": "eslint .",
    "lint:fix": "eslint --fix",
    "format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc"
  },
  "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"
    ]
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^5.30.3",
    "@typescript-eslint/parser": "^5.30.3",
    "eslint": "^7.32.0 || ^8.2.0",
    "eslint-config-airbnb": "^19.0.4",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-import": "^2.25.3",
    "eslint-plugin-jsx-a11y": "^6.5.1",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-react": "^7.28.0",
    "eslint-plugin-react-hooks": "^4.3.0",
    "prettier": "^2.7.1"
  }
}
YokySantiago commented 2 years ago

Thanks for bringing this up; I'd like more information about how you use the node-onfleet wrapper in a web application because it means that you will use the API key in the app, and an ill-intension person could get the Onfleet API key by analyzing your code through the browser tools.