Optimizing Panda CSS Production Builds: Seeking Input #3257
Replies: 2 comments 6 replies
-
Further testing with Next.js showed a roadblock. Panda can read I wish there was a solution to remove styles coming from unused imports, whether local or through the buildinfo file. The challenge is that the buildinfo file is detached from actual imports, which makes optimization approaches like this even harder. Is there an alternative to shipping a buildinfo file? My use case is specifically a design system component library that publishes components and presets to an NPM package, which is then consumed by apps that always use Panda CSS to scaffold styled-system and generate the final CSS file. Panda's documentation has a section for component libraries, but none of the solutions seem to address this particular scenario. |
Beta Was this translation helpful? Give feedback.
-
I think the approach here would be to create a panda css preset for your DS, publish it on the NPM and then use it across the projects. Park UI is using similar approach using the scaffolding function https://github.com/cschroeter/park-ui/blob/main/packages/styled-system/panda.config.ts#L8 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey team 👋
We're exploring a production optimization for our Panda CSS setup and I'd love some feedback.
Current Setup
Proposed Two-Path Approach
Development Path
Perfect for active development with HMR, watch mode, Storybook, etc:
Production Path
Optimized to generate minimal CSS:
Results
Local testing shows significantly smaller CSS output with the production path due to including only the components actually used.
Questions
dist
instead ofsrc
/buildinfo for CSS generation?I understand this introduces a two-step build process that might affect filename hashing or Next.js caching. We'll tackle those separately if this approach is valid.
Thanks for any insights!
Beta Was this translation helpful? Give feedback.
All reactions