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

@react-pdf/reconciler tries to access unlisted dependencies #2967

Closed
wojtekmaj opened this issue Nov 19, 2024 · 6 comments · Fixed by #2980
Closed

@react-pdf/reconciler tries to access unlisted dependencies #2967

wojtekmaj opened this issue Nov 19, 2024 · 6 comments · Fixed by #2980

Comments

@wojtekmaj
Copy link
Contributor

Describe the bug

@react-pdf/reconciler tries to access unlisted dependencies, making the installations non-deterministic and depending on pure luck to work.

To Reproduce

Install @react-pdf using Yarn PnP, which points out such errors immediately instead of failing silently.

Expected behavior

Package to work

Actual behavior

✘ [ERROR] Could not resolve "react"

    ../~/.yarn/berry/cache/@react-pdf-reconciler-npm-1.1.2-7ab8edc928-10c0.zip/node_modules/@react-pdf/reconciler/lib/index.js:1:18:
      1 │ import React from 'react';
        ╵                   ~~~~~~~

  The Yarn Plug'n'Play manifest forbids importing "react" here because it's not listed as a dependency of this package:

    ../.pnp.cjs:2880:31:
      2880 │         "packageDependencies": [\
           ╵                                ~~
✘ [ERROR] Could not resolve "object-assign"

    ../~/.yarn/berry/cache/@react-pdf-reconciler-npm-1.1.2-7ab8edc928-10c0.zip/node_modules/@react-pdf/reconciler/lib/reconciler-26.js:1:13:
      1 │ import e from"object-assign";import n from"react";import*as t from"...
        ╵              ~~~~~~~~~~~~~~~

  The Yarn Plug'n'Play manifest forbids importing "object-assign" here because it's not listed as a dependency of this package:

    ../.pnp.cjs:2880:31:
      2880 │         "packageDependencies": [\
           ╵                                ~~
✘ [ERROR] Could not resolve "scheduler"

    ../~/.yarn/berry/cache/@react-pdf-reconciler-npm-1.1.2-7ab8edc928-10c0.zip/node_modules/@react-pdf/reconciler/lib/reconciler-26.js:1:66:
      1 │ ...rom"react";import*as t from"scheduler";function r(e){return e&&e...
        ╵                               ~~~~~~~~~~~

  The Yarn Plug'n'Play manifest forbids importing "scheduler" here because it's not listed as a dependency of this package:

    ../.pnp.cjs:2880:31:
      2880 │         "packageDependencies": [\
           ╵                                ~~
@edellucien
Copy link

I have this problem too.
Versions:
"@react-pdf/renderer": "4.1.4",
"next": "14.2.16",
"react": "18.2.0",

@szymekTS
Copy link

Hello have the same problem:

  • react-pdf/renderer@4.1.2
  • next@15.0.3
  • react@18.3.1

./node_modules/@react-pdf/reconciler/lib/reconciler-26.js:1:51 Module not found: Can't resolve 'scheduler'

@bkniffler
Copy link

Same with bun

@jrtell1
Copy link

jrtell1 commented Nov 22, 2024

Same here, have unsuccessfully attempted suggested solutions such as:

  • Upgrading to latest version of react pdf
  • Rebuilding .lock file
  • Clearing node_modules

@saengmotmi
Copy link

Hi, @wojtekmaj

I noticed that the library relies on scheduler as part of its functionality, but it is not explicitly declared in peerDependencies. This can cause issues in stricter dependency management environments, such as Yarn PnP, where undeclared dependencies are not automatically resolved.

Would it make sense to add scheduler as a peerDependency to ensure compatibility, especially since it's tightly coupled with React? This might also help avoid potential version mismatches between scheduler and React.

@jrtell1
Copy link

jrtell1 commented Nov 26, 2024

@diegomura Thank you! ❤️

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 a pull request may close this issue.

6 participants