Skip to content
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

Tree shaking / code splitting #488

Open
lovrozagar opened this issue Mar 11, 2024 · 1 comment
Open

Tree shaking / code splitting #488

lovrozagar opened this issue Mar 11, 2024 · 1 comment

Comments

@lovrozagar
Copy link

I am building a component library for Next.js, using bunchee to compile but when using only one component out of many in the consumer app, my whole library is included in the built app bundle size. Looking at the build file that bunchee generates for the component library, code is split into many smaller files, I am using "use client" directive somewhere and those components are separate files too.

Maybe I am missing something. It would be good to note what is needed for tree shaking in the docs as I am unable to find more info on this topic.

Code_rqXRvvjZXk

@huozhi
Copy link
Owner

huozhi commented Mar 18, 2024

Can you share a reproduction with both library and your next.js code? It has few factors that could effect the tree-shaking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants