-
-
Notifications
You must be signed in to change notification settings - Fork 233
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
[Feature]: Tree Shaking with only one primitive #449
Comments
I fully support the idea 👍 |
Semi-related #443 Also, it's preferred not to use Vite config example |
@madebyfabian how was your setup yaa? You are using Radix-vue's Nuxt modules? |
@zernonia I am using it with the latest nuxt If it helps, I can create a reproduction repositiory. |
@zernonia So you mean the current stats (52kb client, 82kb server) are already the tree-shaked version? Is there a way to shrink it down? Background is: I want to fit my nuxt nitro build inside a edge function, where 1MB is the size limit. I installed headlessui/vue and replaced my modal to use the Dialog from headlessui to compare the size. Their currently at 25kb client, 0kb server. And I am not sure if they even do tree shaking. If the tree shaking is already working and that's the minimum size to get to, then I think I can close this ticket. |
There's still some room for improvement . We can push it down to 36kb after extracting You sure headless-ui is serving 0kb in server? 😮 |
@zernonia Yes as far as I can tell. This is my implementation: Vue Component<template>
<div class="lg:hidden">
<button
@click="isOpen = true"
aria-label="Menü öffnen"
class="rounded-full bg-primary-700/10 flex items-center justify-center w-9 h-9">
<NuxtIcon name="menu" class="text-gray-500 text-xl" />
</button>
<Dialog :open="isOpen" @close="isOpen = false">
<DialogPanel class="fixed bg-primary-700 text-white p-6 focus:outline-none z-30 inset-0 w-full h-full">
<DialogTitle class="hidden">Menü</DialogTitle>
<div class="flex justify-end">
<button
@click="isOpen = false"
class="rounded-full bg-white/10 flex items-center justify-center w-9 h-9">
<NuxtIcon name="close" class="text-white text-xl" />
</button>
</div>
<slot />
</DialogPanel>
</Dialog>
</div>
</template>
<script setup lang="ts">
import { Dialog, DialogPanel, DialogTitle } from '@headlessui/vue'
const route = useRoute()
const isOpen = ref(false)
// Close when user navigates
watch(
() => route.fullPath,
() => {
isOpen.value = false
}
)
</script> And it results in 0kb Server Side. But it causes a hydration mismatch, forcing me to wrap it inside |
Icic.. thanks for the insight @madebyfabian ! hmmm I wonder how to achieve 0kb server bundling tho.. you have any idea how this can be achieve? 🤔 |
@zernonia I would love to assist on this! Currently I don't have an idea 😄 |
Will close this off yaa @madebyfabian as Tree-shaking is working correctly. But I will keep this in mind and we can look into how headless/ui bundle with 0kb server side in other ticket 😁 |
Describe the feature
I just discovered that
radix-vue
is adding 50kb to my build. I am only using the Dialog though, nothing else.It would be great for performance if there was a way to actively tree-shake it, something like
because it's hard for me to imagine that only the Dialog primitive taking up more than 50kb.
Additional information
The text was updated successfully, but these errors were encountered: