-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Breaks in pnpm environment #394
Comments
So I've never used pnpm and I wasn't really planning on supporting it, although it's nice to identify this issue twice as a pnpm specific issue. I have no idea what's happening. My immediate guess is that the Even if I were to support this, I'm not sure how to maintain it. It seems difficult to get CI to setup a repo with each package as a dependency, attempt npm/yarn/pnpm install, build, and determine that running also works (because in this case, it's actually running the studio that identifies the issue). Without this full pipeline, the chances that I re-break pnpm without knowing it are extremely high. |
Got snagged by this as well 😢. It'd be nice to add a warning to the readme page saying it'll break if you use |
Yeah its a tricky issue. I did not have the time to dig into it yet, but my suspicion is that it has something to do with the portabletext editor dependency, since that is the only one in this package that depends on styled components. I hope to be able to look into this later, but if you find out something I'm curious to hear your findings. |
Also stumbled on it. 😕 Will also try to dig into it soon. |
Anyone have any ideas of how to test this in CI, before we tackle solving it? I took a first swing at it, but ended up with a solution on how to build this whole repo using pnpm, which is not what I want. I want to figure out if, when another repo uses @sanity-typed/types (as an example, we can run tests for each package) and pnpm, that we don't get build errors. I'm also concerned that, even with the reported errors, it's not building the sanity studio that's failing but running it, which seems even worse to test. I'm convinced this isn't just difficult to test, but flaky to maintain. Basically, how do other libraries that don't use pnpm internally validate when an application using the library does use pnpm? |
(separately it looks like there's some other issue involving portable text and pnpm which, if we had this CI setup, would hopefully identify that into a separate issue.) I'm sure pnpm has it's own pros and cons, but the fact that it doesn't work with libraries that do work with npm is pretty terrible. Pretty difficult to argue it's a drop-in replacement for npm when arbitrary libraries just don't work with it. |
Hm yes, it sounds like this will be a very tricky issue to test. Not impossible, but I'm wondering if it's worth the resources and I agree it sounds flaky as hell. Locally I remember testing this by changing stuff, re-running a one line command that built and ran the production app ( Maybe it's good to first figure out what's causing this issue and then considering if that's something worth adding tests for. What do you think? I'm expecting this to be an upstream bug from either the portable text package, possibly some edge case in how the dependencies are declared that pnpm is stricter about. If we're really unlucky maybe even a bug in pnpm itself. I agree with your frustration about pnpm. Even though I've ran into annoying issues like these a couple of times now, I still prefer using it myself. Additionally I think it's only growing in popularity, so it's probably worth the effort to figure this out. |
Maybe this will help? I couldn't really sort it out but it might be helpful. |
I think it's safe to assume this package should work with any popular package manager. I personally don't feel testing for these kind of issues is something you have the responsibility to add to the CI of this package, even though I do understand you can't fully claim to support pnpm if you don't. As also mentioned on the pnpm website, this probably points towards an issue with one of your dependencies and should be fixed there. I've played around with it a bit more and I'm starting to think the problem is actually the
Of course this isn't conclusive at all, especially since I had to build the package to ESM, but I hope I might trigger some new ideas by sharing this. |
@waspeer, can you push a minimal repro of the sanity project with issues (step 3) and link it here? I'd like to see what is actually happening for myself. |
https://github.com/waspeer/sanity-typed-issue This repo includes step 1-4 in my comment. Let me know if this works for you. |
Looks very thorough! I'll take a look soon. |
I think we might be talking past each other here. In my last comments I was just sharing my process debugging the issue. I shared my process because this a hard issue to debug and I was hoping we might help each other navigate this that way. The step you wanted me to replicate in the repo was just an intermediate step in this process and not an attempt to replicate the exact original error. Just to be completely clear, I'm aware there are a few imperfections in my approach, specifically that the local building and linking of the package is not representative of the actual usage of this package. I think the main point is that I got Styled Components related issues that I was able to pinpoint to the importing of the |
I think a lot of issues (and solutions) are getting introduced all together under "pnpm issues" and I really can't approach it all as one chunk. But yes, I did miss the point of what you were doing. It also just dawned on me that you didn't have everything in one branch, but in multiple different commits for the different stages. 🤣 This is the order I'd love to accomplish things:
Jumping to fix 3 is going to be a ticking time bomb for a regression, so I'm trying to defer the rest until we have 1 & 2. I will end up breaking pnpm users without it in CI, so fixing it now without CI testing for it isn't something I think we should do. |
I was about to try a solution involving
I have no idea how I'd even I'm just going to run your steps and see if there's an easy fix for this current issue at hand and, if so, release that. But I don't really feel comfortable claiming pnpm support going forward without being able to validate it automatically. |
OK, I have a super small repro: https://gist.github.com/saiichihashimoto/1349697a7dbc64096a89ffc7c6cee771 It only fails on |
@waspeer @shixish @mrr11k I know it's been almost a year (and I've broken some ribs in that time, FUN) but I'm starting to re-address some of these bigger issues. I'm sure you've found other solutions, but could you see if the most up-to-date versions of @sanity-typed/* don't break your pnpm environments? I'm imagining the current repros are too out of date to be relevant anymore. |
Hi!
Thanks for making this package! It's fantastic :)
I'm using pnpm as my package manager and I have been getting errors after building Sanity studio. To reproduce:
The error I'm getting:
This error resolves when I change this line back:
I wasn't able to create a StackBlitz or something similar doing these steps, so I'm not sure how this reproduces on other machines. I'm using a Macbook Pro with Ventura 13.4
The text was updated successfully, but these errors were encountered: