react icon indicating copy to clipboard operation
react copied to clipboard

Bug: Since React 19 release my React 18 builds with npm ci are failing

Open michaelgrewal opened this issue 11 months ago • 3 comments

As soon as React 19 was published on December 5, 2024 approx 4:05PM EST, all my builds for React 18 (18.3.1) in my CICD pipeline are failing with Linting and Types errors raised from when yarn build is building my Next JS v 14.0.4 app.

React version: 18.3.1

Before the release, I was able to build my React 18 app without issue, I was building dozens per day. As soon as the React 19 was published it all broke. Any reason for this? I have React 18.3.1 locked in my package.json, my dependency versions are all the same. Did something change with React 18.3.1 version?

michaelgrewal avatar Dec 06 '24 01:12 michaelgrewal

I think it maybe has to do with the package "@types/[email protected]"

michaelgrewal avatar Dec 06 '24 02:12 michaelgrewal

Or perhaps npm isn't resolving @types/react": "*" in package-lock.json to a consistent version anymore ever since some release today.

npm was resolving fine up until today's release. Something changed today.

michaelgrewal avatar Dec 06 '24 03:12 michaelgrewal

I had to downgrade my React to 18.2.x and specify resolutions in my package.json so that dependencies like react-syntax-highlighter work:

"resolutions": {
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "@types/react": "18.2.45",
    "@types/react-dom": "18.2.18"
  }

This wasn't necessary before today's React 19 release

michaelgrewal avatar Dec 06 '24 04:12 michaelgrewal

Packages published from DT unfortunately list * as the dependency range. We're in the process of migrating away from it but in the meantime, use resolutions or ideally a lockfile since any type release could potentially break your pipeline.

eps1lon avatar Dec 06 '24 16:12 eps1lon

I had to downgrade my React to 18.2.x and specify resolutions in my package.json so that dependencies like react-syntax-highlighter work:

"resolutions": {
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "@types/react": "18.2.45",
    "@types/react-dom": "18.2.18"
  }

This wasn't necessary before today's React 19 release

Thank you, been banging my head against the same problem. This fixed my build.

grfxjedi avatar Dec 06 '24 18:12 grfxjedi