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

Fix Tree-shaking support #1247

Merged
merged 2 commits into from
Mar 17, 2022
Merged

Fix Tree-shaking support #1247

merged 2 commits into from
Mar 17, 2022

Conversation

RobinMalfait
Copy link
Collaborator

@RobinMalfait RobinMalfait commented Mar 16, 2022

Instead of bundling everything into a single ESM file, we generate every single file as ESM. This is what we did in 1.4.x as well. This in turn should fix the tree-shaking that was broken.

Closes: #1238

Before:
image

After:
image

@vercel
Copy link

vercel bot commented Mar 16, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

headlessui-react – ./packages/playground-react

🔍 Inspect: https://vercel.com/tailwindlabs/headlessui-react/3osedCQzXcZsVfazwyyFP6H3inAh
✅ Preview: https://headlessui-react-git-fix-tree-shaking-tailwindlabs.vercel.app

headlessui-vue – ./packages/playground-vue

🔍 Inspect: https://vercel.com/tailwindlabs/headlessui-vue/CAXqMHmfpanV6ifJoovSbSyJLXJf
✅ Preview: https://headlessui-vue-git-fix-tree-shaking-tailwindlabs.vercel.app

Instead of bundling everything into a single ESM file, we generate every
single file as ESM. This is what we did in 1.4.x as well.

I would expect if your library had a single ESM file and you only used 1
function that the application you use it in correctly does the
tree-shakign for you. Apparantly a lot of applications are not properly
setup for this, so let's create multiple files instead.
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

Successfully merging this pull request may close these issues.

Tree shaking is broken
1 participant