How is Panda in very large projects? No tree-shaking, right? #2761
Replies: 2 comments 8 replies
-
I've been wondering about similar things and now also why it's not done automatically at least with variables. In case of dynamic access maybe? There's also the work @astahmer did here and mentioned HMR as the main reason for abandoning it. But I don't think anybody cares about optimizations in dev? I would expect these things to happen by default only when building for production. Are there other reasons for not doing it? |
Beta Was this translation helpful? Give feedback.
-
Here's a POC showing one way that this could be done by telling panda to check for styles in a temporary tree-shaken output instead of src files. The big catch is that this doesn't work with the JSX utilities. |
Beta Was this translation helpful? Give feedback.
-
For anyone using Panda in a very large project, I'm interested in hearing how big the generated CSS file is. We are considering Panda for a very large monorepo (hundreds of packages, dozens of apps).
From what I can tell, Panda generates the css pretty simply based on the file matching pattern that you pass into the
include
in panda.config.ts. These are source files and it doesn't do anything to check if a file is actually referenced in a production build. Is that right?I see this documentation about removing unused variables, but I'm also interested in unused classes. In a simple test, I added
<Box p="123px">
to a component that doesn't get imported anywhere, and it was included in my CSS output.(to be clear, I know tree-shaking based on which source files are used would be extremely complicated. The approach Panda uses might be a fine trade-off - I just want to make sure I understand it correctly)
Beta Was this translation helpful? Give feedback.
All reactions