Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for [email protected] #400

Open
AliSaberi opened this issue Nov 27, 2022 · 9 comments
Open

support for [email protected] #400

AliSaberi opened this issue Nov 27, 2022 · 9 comments

Comments

@AliSaberi
Copy link

It seems that the library does not support the react version 18.2.0

ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from [email protected]
npm ERR! node_modules/react-lazyload
npm ERR! react-lazyload@"*" from the root project

@jeromelachaud
Copy link

Same with [email protected]

npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [REDACTED]@0.1.0
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from [email protected]
npm ERR! node_modules/react-lazyload
npm ERR!   react-lazyload@"3.2.0" from the root project

@peZhmanParsaee
Copy link

I can see in the package.json file of this repository it supports React v18.x.x :

"peerDependencies": {

But it seems that changes have not been published to the npm registry yet. Because until now the that I write this comment, the npm registry of this repo was updated 2 years ago the last time.
https://www.npmjs.com/package/react-lazyload

@KonkretneKosteczki
Copy link

I know it does not actually solve the underlying issue but as a workaround adding custom type resolution to your package.json seems to get rid of the error.

for yarn

  "resolutions": {
    "@types/react": "^18.0.25"
  },

and for npm

"overrides": {
  "@types/react": "^18.0.25"
},

@jeromelachaud
Copy link

I do already have "@types/react": "^18.0.25", entry as a devDependency.

@jeromelachaud
Copy link

jeromelachaud commented Dec 1, 2022

ho, did you mean?:

"overrides": {
    "react-lazyload": {
      "@types/react": "^18.0.25"
    }
  }

Still got the error any way

@peZhmanParsaee
Copy link

@KonkretneKosteczki Thank you for this great tip.

@jeromelachaud The below change made the error to be gone:

"overrides": {
    "react-lazyload": {
      "react": "^18.2.0",
      "react-dom": "^18.2.0"
    }
  }

Actually react and react-dom should be set not @types/react

@jeromelachaud
Copy link

Awesome 🔥
Thanks @peZhmanParsaee @KonkretneKosteczki!

@ikarus-pritish
Copy link

@ameerthehacker Would it be possible to make a release to npm with this? Its been a hassle.

@AakashRao-dev
Copy link

Thanks @peZhmanParsaee 💪

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

No branches or pull requests

6 participants