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

fix: don't require optional peerDependencies #2197

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thebanjomatic
Copy link

@thebanjomatic thebanjomatic commented Sep 25, 2023

@vue/server-renderer and @vue/compiler-dom were both required in the
sense that they will throw regardless of whether or not your are using
functionality from those libraries if they weren't installed. I don't
believe this was intentional, so I have made them optional and they will
now only throw if you try to use them and the package isn't available,
and will print a more helpful error message when doing so.

@netlify
Copy link

netlify bot commented Sep 25, 2023

Deploy Preview for vue-test-utils-docs ready!

Name Link
🔨 Latest commit e0585e4
🔍 Latest deploy log https://app.netlify.com/sites/vue-test-utils-docs/deploys/6511c0b99aba2a000846dcd1
😎 Deploy Preview https://deploy-preview-2197--vue-test-utils-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@thebanjomatic thebanjomatic marked this pull request as draft September 25, 2023 17:02
`@vue/server-renderer` and `@vue/compiler-dom` were both required in the
sense that they will throw regardless of whether or not your are using
functionality from those libraries if they weren't installed. I don't
believe this was intentional, so I have made them optional and they will
now only throw if you try to use them and the package isn't available,
and will print a more helpful error message when doing so.
@thebanjomatic thebanjomatic changed the title fix: making optional peer dependencies actually optional fix: don't require optional peerDependencies Sep 25, 2023
@thebanjomatic thebanjomatic marked this pull request as ready for review September 25, 2023 17:32
@lmiller1990
Copy link
Member

How can I reproduce and test the issue this supposedly fixes? I am not comfortable merging this as it - I don't know what it fixes or how to test it.

@thebanjomatic
Copy link
Author

I'll see if I can create a small reproducer.

@thebanjomatic
Copy link
Author

thebanjomatic commented Nov 8, 2023

I created a test repo that demonstrates 3 separate failures across yarn, pnpm and npm that are related to the issue in this PR. I was really hoping to just see the same problem manifest itself in the same way 3 times, but funny enough each package manager seems broken in slightly different ways.

https://github.com/thebanjomatic/test-utils-repro/

@dschmidt
Copy link

dschmidt commented Feb 7, 2024

Today (after updating test-utils) I ran into the issue fixed by this PR.
pnpm has stricter package isolation than classic npm or yarn, so when unconditionally importing the module without having it as a dependency, it will always fail.

For now my workaround is to add

hoist-pattern[]=@vue/server-renderer

to my .npmrc.

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.

None yet

3 participants