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

provide a better debugging experience when peer dependencies cause multiple resolution of singleton packags #6617

Open
MichaelBelousov opened this issue Apr 12, 2024 · 1 comment

Comments

@MichaelBelousov
Copy link
Contributor

MichaelBelousov commented Apr 12, 2024

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

3 or 4 different projects I am aware of in the last two weeks ran into issues where dependency updates caused undesired multiple resolutions of itwinjs-core packages which is illegal and causes (occasionally nefarious) runtime errors.

Sometimes people will accidentally commit the broken resulting lockfile too.

Describe the solution you'd like

  • for @itwin/build-tools or some published package to ship a utility function that can be imported in any project's .pnpmfile.cjs to error out on attempts to install a dependency arrangement that results in illegal multi-resolved singleton packages. This will help people more quickly notice when they've screwed up a project, not at runtime
  • a guide or link to an existing guide on debugging multi-resolved peer dependencies in pnpm. Maybe placed in a FAQ or in tips and guidelines, next to the API support policy

I'm open to other potential solutions and discussions. I'd be curious if anyone has researched:

  • * wildcard versions for some peer dependencies
  • meta packages
    • these would need to be tested for tree-shakability, and possibly itwin.js packages need to conform to the package.json#sideEffects standard used by bundlers.
  • pnpm auto install peers

Describe alternatives you've considered
pnpm override everything... causes other issues.

Additional context
None

@grigasp
Copy link
Member

grigasp commented Apr 15, 2024

One of the reasons that can happen is that peerDependencies in itwinjs-core are specified with ^, which tells package manager that it's fine to use a higher version. The first step, IMO, should be to fix this problem and instead specify all peer deps at exact version.

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

2 participants