create-react-app-redoc icon indicating copy to clipboard operation
create-react-app-redoc copied to clipboard

Not compatible with react-scripts 5.0.0

Open ameyer15801 opened this issue 3 years ago • 1 comments

The tutorials and this template app do not build or start with the latest redoc and react-scripts versions due to many errors about polyfills for node.js core modules, all coming from redoc code

This does not work:

  "dependencies": {
    "core-js": "^3.21.1",
    "mobx": "^6.5.0",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "redoc": "^2.0.0-rc.66",
    "styled-components": "^5.3.5"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build"
  },
  "devDependencies": {
    "react-scripts": "^5.0.0"
  }

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.

Keeping everything the same, but downgrading react-scripts, makes it work again.

  "devDependencies": {
    "react-scripts": "4.0.3"
  }

react-scripts hides webpack configurations, so we cannot provide fallbacks as suggested. This was previously mentioned as being fixed a couple months ago, but I have been stuck on this error for 2 days until I figured out the downgrade workaround.

ameyer15801 avatar Apr 10 '22 01:04 ameyer15801

Is there a workaround without downgrading the react-scripts version?

SafaMjn avatar Jan 13 '23 10:01 SafaMjn