-
Notifications
You must be signed in to change notification settings - Fork 296
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
Issue with monorepo + vanilla extract #1494
Comments
I've added a full repro of the issue! |
Thanks for the reproduction @AlemTuzlak. I'm unsure if your solution is the right way to fix this, but I'll dig into this when I get some more time. |
To be honest I assumed it isn't, I also noticed that the styles don't get bundled properly in production with my fix and locally there's a FOUC before it loads up |
After a bit more investigation it seems that when @vanilla-extract/css is added into optimizeDeps include in the vite config the horrible FOUC goes away which was not the case before when it was a part of the repo, not sure if this is a bug with vanilla or just a vite thing though |
At @AlemTuzlak did you end up getting a solution you were happy with? I am trying to migrate a styled-components monorepo (also using pnpm and turbo) to vanilla-extract |
Unfortunately not @j-mcfarlane this has kind of completely frozen our whole migration process and we're majorly blocked. Hoping this gets resolved soon, but it's been like a month so not as hopeful 😅 |
@AlemTuzlak I have been in the same boat, experimented with using panda-css, linaria, pigment and now vanilla-extract. Only thing ive gotten to work is tailwind - however im not a big fan. |
I personally only use tailwind, but our client uses vanilla, so we wanted to extract half the codebase into reusable shared pieces, but vanilla stopped us dead in our tracks. I don't have the capacity to sit down and debug this, unfortunately, so I'm hoping the maintainers will get it sorted, shouldn't be that hard with a repro I hope |
@AlemTuzlak Sorry for taking so long to get to this. I can't reproduce your error exactly. Running your reproduction, I see these errors instead:
What's interesting is that the CSS loads just fine. Just as a side note, in future it would be greatly appreciated if your reproduction was much more minimal. It seems like you ripped out some relevant parts of a production app and put them in a repo, which is a good start, but there were many dependencies that are unused and not helpful when diagnosing issues. Additionally, it would've be nice to mention that your app uses Remix + Hono. I spent some time setting up a Remix application that matched your monorepo setup without hono, and it works fine. The introduction |
Describe the bug
I don't have a reliable reproduction yet as it's EOD and the setup is rather complex so I'll try to put one together but I've debugged it deep enough to give you a basic idea of what's going on.
I've played around in the
vanilla-extract-vite-plugin.cjs.dev.js
file that comes in the dist of the latest vanilla extract package and I've found the root cause of the issue, before I go into that, first a bit of context.We have a monorepo setup where we have apps under
/apps/external/<appname>
and then we have packages underpackages/<packagename>
. I decided to move vanilla extract styles out of the app directly intopackages/ui
and what I've noticed is that it crashes and it complains it can't find the file with the following path:C:\Users\Alem Tuzlak\projects\site-next\apps\external\marketing-website\@id\C:\Users\Alem Tuzlak\projects\site-next\packages\ui\css\_global.css.ts.vanilla.css
After a bit of debugging I've added this code:
inside of the vite plugin and the issue went away. It goes into the else statement here and because the
filePath
param provided to the function starts with an@id
for some reason they both get fused together into an invalid URL which results in a crash on vanilla extract side due to trying to resolve an invalid path. I know that the above solution is not the most elegant one but it fixed the problem for me.Reproduction
https://github.com/AlemTuzlak/vanilla-extract-issue
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: