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

bundle react-reconciler to avoid peerDeps problem #2140

Merged
merged 2 commits into from
Jan 28, 2023

Conversation

jeetiss
Copy link
Collaborator

@jeetiss jeetiss commented Jan 14, 2023

another try to solve react peer dependency problem

I found a way to test it.

npm supports installations from the tar archive, so I bundle a @react-pdf/renderer with those changes to a tar file with npm pack command and install into some new project

  • The current master fails with error:
npm i ./react-pdf-renderer-3.0.3.tgz
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm 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@"^16.8.6 || ^17.0.0" from @react-pdf/[email protected]
npm ERR! node_modules/@react-pdf/renderer
npm ERR!   @react-pdf/renderer@"file:react-pdf-renderer-3.0.3.tgz" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
  • peerDependencies "react": "^16.8.6 || ^17.0.0 || ^18.0.0" has the warning:
npm i ./react-pdf-renderer-3.0.3.tgz
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"^18.2.0" from the root project
npm WARN   1 more (@react-pdf/renderer)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.0.0" from [email protected]
npm WARN node_modules/@react-pdf/renderer/node_modules/react-reconciler
npm WARN   react-reconciler@"^0.23.0" from @react-pdf/[email protected]
npm WARN   node_modules/@react-pdf/renderer
npm WARN 
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^16.0.0" from [email protected]
npm WARN   node_modules/@react-pdf/renderer/node_modules/react-reconciler
npm WARN     react-reconciler@"^0.23.0" from @react-pdf/[email protected]
npm WARN     node_modules/@react-pdf/renderer

  • When react-reconciler is bundled everything is installed without errors and warnings 🥲
npm i ./react-pdf-renderer-3.0.3.tgz

added 65 packages, and audited 66 packages in 10s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

fix #1878

@jeetiss jeetiss self-assigned this Jan 18, 2023
@jeetiss jeetiss merged commit 327f071 into master Jan 28, 2023
@jeetiss jeetiss deleted the try-to-fix-react-peer-deps branch January 28, 2023 10:05
@Sebastian-Nielsen
Copy link

Can you please show exactly how you did this:

so I bundle a @react-pdf/renderer with those changes to a tar file with npm pack command and install into some new project

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

Successfully merging this pull request may close these issues.

React 18 peerDeps problem
2 participants