Tree shaking
See original GitHub issueWhat package within Headless UI are you using?
What version of that package are you using?
v0.2.0
What browser are you using?
Chrome
Reproduction repository
https://github.com/tailwindlabs/tailwindcss.com
(As mentioned in Discord)
I don’t think Tree Shaking is working / fully optimized. You can see this even in the bundle on tailwindcss.com – the only Component in use is <Switch />
and yet inspecting the (impressive!) coverage of the website’s Next.js bundle contains references to headlessui-menu
, headlessui-listbox
, etc.
This is more problematic using Components from the dev branch where even more Components are bundled – whether they’re in use or not.
(I could be misunderstanding something about the nature/purpose/design of tree shaking in this context I just thought to mention it)

Issue Analytics
- State:
- Created 2 years ago
- Reactions:21
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Tree shaking - MDN Web Docs Glossary
Tree shaking is a term commonly used within a JavaScript context to describe the removal of dead code. It relies on the import...
Read more >Tree Shaking - webpack
Tree shaking is a term commonly used in the JavaScript context for dead-code elimination. It relies on the static structure of ES2015 module...
Read more >Tree shaking - Wikipedia
In computing, tree shaking is a dead code elimination technique that is applied when optimizing code. Often contrasted with traditional single-library dead ...
Read more >Tree-Shaking: A Reference Guide - Smashing Magazine
Simply put, tree-shaking means removing unreachable code (also known as dead code) from a bundle. As Webpack version 3's documentation states: “ ...
Read more >Reduce JavaScript payloads with tree shaking - web.dev
Tree shaking is a form of dead code elimination. The term was popularized by Rollup, but the concept of dead code elimination has...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
hey guys, maybe something changed and tree shaking got broken along the way. I can take a look later because right now trying to flee Russia 😬
Yeah well first things first… 😂
Best of luck!