Does shadcn/ui support tree shaking in a monorepo setup? #8093
Unanswered
fahrulalwan
asked this question in
Q&A
Replies: 1 comment
-
Tree shaking will work fine here. When you build |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a question about the expected tree shaking behavior when using a shared
shadcn/ui
component library within a Turborepo monorepo.Context
My project is structured as a monorepo with a shared UI library and multiple applications.
Monorepo Structure:
The
my-shadcn-lib
contains several components built withshadcn/ui
:Each application only imports the specific components it needs from
my-shadcn-lib
.app-a
importscomponent-a
andcomponent-b
.app-b
importscomponent-c
andcomponent-d
.app-c
importscomponent-e
andcomponent-f
.Question
When I build a specific application (e.g.,
app-a
), will the final production bundle only include the code for the components it explicitly imports (component-a
andcomponent-b
)?Or, will the bundle include all components (
component-a
throughcomponent-f
) from the entiremy-shadcn-lib
library?assuming
app-a
&app-b
are usingnext.js
andapp-c
is usingvite
.Beta Was this translation helpful? Give feedback.
All reactions