-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
bug: missing transitive postcss
peer dependency
#3191
Comments
Thank you @rtritto
for reporting issues. It helps daisyUI a lot 💚
|
Can you please describe the issue? Offering a solution needs describing the problem first. |
|
My friend, are you having an issue on installation in any environment? |
I'm using yarn berry and with I have to use a workaround for that issue (missing dependency):
+packageExtensions:
+ daisyui@*:
+ dependencies:
+ postcss: '*' |
Probably you are using a package manager that autoinstall transitive peer dependencies (shadow behavior) and the issue is hidden. |
Thanks for more explanation. Because what you're suggesting is not logical. A dependency can not possibly list all the peer dependencies of its dependencies as peer dependency. |
It's a warning, so no, it's not blocking. I can use the workaroud until the fix.
Peer dependencies aren't installed by all package managers. That's why you see a peer dependency also in the dev dependencies (the peer dependency is used in tests or in build). All plugin libraries have that logic. E.g.:
All projects work using that logic as standard. From answer https://stackoverflow.com/a/68575682 and source https://yarnpkg.com/advanced/error-codes#yn0002---missing_peer_dependency # bad
project
├─D> packagePeer
└─D> packageA
└─P> packageB
└─P> packagePeer
# good
project
├─D> packagePeer
└─D> packageA
├─P> packagePeer
└─D> packageB
└─P> packagePeer |
@saadeghi if it's not enough, I can tag other expert users to exaplain better this issue |
Post CSS is not required for daisyUI to work.
So I think you should either ignore the warning, or disable it. Warning ≠ Error. |
package.json of "peerDependencies": {
"postcss": "^8.4.21"
}, To have "peerDependenciesMeta": {
"postcss": {
"optional": true
}
} |
That's because yarn berry autoinstall missing peer dependencies to not break dependency tree resolution. |
Even if it doesn't install |
So, if DaisyUI uses |
You can check in node_modules directory and you will find DaisyUI should explicit |
All this is well documented on yarn site. |
That's not true. No one adds all the peer dependencies of all their dependencies (and sub dependencies) as peer dependency. It's not realistic and no package does it. There are packages out there with 100+ dependencies. Each dependency has multiple other dependencies. All of them have their own peer dependencies. With every release any package can add or remove any peer dependency. The consumer package can not possibly keep track of all those peer dependencies and manually(?) add/remove them to their package.json file. It's even funny to do such thing. I appreciate your effort for the PR and opening the issue. And thanks for the conversation. Unfortunately it's not something we can add unless we start using the With the upcoming version of Tailwind (4) and the upcoming version of daisyUI (5), there will be even less dependencies hopefully and we will even remove |
You can check, almost all libraries add a dependency (because it's listed in the peer dependencies) and doesn't use it directly in the code.
Peer dependency mean that all dependencies in that list are not installed but the project still use them. When a peer dependency is removed, a major version of that library is released. This helps when migrating the version.
The issue isn't fixed, I will keep this issue opened to advise and help (with workaround or other) users. |
An article written by author of yarn package manager: Implicit Transitive Peer Dependencies Source and some info in comments: preactjs/next-plugin-preact#46 (comment) FYI @saadeghi |
What version of daisyUI are you using?
v4.12.10
Which browsers are you seeing the problem on?
No response
Reproduction URL
NA
Describe your issue
postcss-js
haspostcss
as peer dependency.daisyui
usepostcss-js
dependency and it should also includepostcss
as dependency or peer dependency.The text was updated successfully, but these errors were encountered: