question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What package within Headless UI are you using?

@headlessui/react

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)

Screen_Shot_2021-04-03_at_1 35 26_pm

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:21
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
TheRusskiycommented, Mar 1, 2022

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 😬

3reactions
Ojaycommented, Mar 1, 2022

Yeah well first things first… 😂

Best of luck!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found