prismicio / prismic-gatsby

Gatsby plugins for building websites using Prismic
https://prismic.io/docs/technologies/gatsby
Apache License 2.0
313 stars 97 forks source link

Officially support React 18 in gatsby-plugin-prismic-previews #507

Closed patrickbenjamin1 closed 2 years ago

patrickbenjamin1 commented 2 years ago

Is your feature request related to a problem? Please describe.

npm install gives a peer dependency error when using React 18

npm ERR! While resolving: my-cool-website@1.0.0
npm ERR! Found: react@18.1.0
npm ERR! node_modules/react
npm ERR!   react@"18.1.0" from the root project
npm ERR!   peer react@"^16.9.0 || ^17.0.0 || ^18.0.0" from gatsby@4.14.0
npm ERR!   node_modules/gatsby
npm ERR!     gatsby@"4.14.0" from the root project
npm ERR!     peer gatsby@"^3.0.0-next.0 || ^4.0.0-next.0" from gatsby-plugin-prismic-previews@5.2.6
npm ERR!     node_modules/gatsby-plugin-prismic-previews
npm ERR!       gatsby-plugin-prismic-previews@"*" from the root project
npm ERR!     4 more (gatsby-plugin-image, gatsby-plugin-sharp, ...)
npm ERR!   2 more (react-dom, gatsby-plugin-image)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.9.0 || ^17.0.0" from gatsby-plugin-prismic-previews@5.2.6
npm ERR! node_modules/gatsby-plugin-prismic-previews
npm ERR!   gatsby-plugin-prismic-previews@"*" from the root project
npm ERR!

As there are no breaking changes in React 18 that should effect this package, forcing works fine, but this error is a shame

Describe the solution you'd like

Add React 18 to accepted peer dependencies

Describe alternatives you've considered

Using --force when installing the package

angeloashmore commented 2 years ago

Thanks for the report, @patrickbenjamin1! I just published a fix that adds React 18 support. You can see the changes here: #508

Could you update to the following package version?

If this doesn't fix the issue, please let me know and I'll take another look. Thanks!