Conversation
|
|
✅ Deploy Preview for nuxt3-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
|
What about instead tree-shaking out the component + its children from the final build, so it really leaves no trace? |
|
We can add a custom core unplugin like the What do you think @danielroe ? |
|
Exactly. Might possibly be within the same plugin. |
|
I created another plugin to remove in templates, since the tree-shake runs on vue script and js/ts files. But this would not tree-shake stateless components call like: <script setup lang="ts">
import { h } from 'vue'
import { DevOnly } from "#components"
const dynamic = () => h(DevOnly, "Should be dev only")
</script>
<template>
<component :is="dynamic" />
</template>Maybe I can take care about this on the initial tree-shake plugin, and rename them to something like Edit: I will use this https://github.com/nuxt/framework/blob/main/packages/nuxt/src/components/tree-shake.ts |
|
Hey! This is excellent work 🤩 Can't wait to have this merged, this will be so useful to enhance DX on themes :) |
🔗 Linked issue
resolves nuxt/nuxt#15066
❓ Type of change
📚 Description
Introduce
<DevOnly>component that render its content only in development mode.📝 Checklist