You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
v2 breaks vue Style component inside Head component in Nuxt v3.16 #517
Up to Nuxt 3.15.4, this used to work as expected in the default.vue layout component:
<templatelang="html"><Head><Stylechildren="body { background: red }" /></Head></template>
Nuxt v3.16 breaks this due to unhead v2. Even switching children to textContent doesn't fix it, I need to deploy an additional awkward workaround for it to work again, using <component :is="'style'">:
<templatelang="html"><Head><component:is="'Style'" textContent="body { background: red }" /></Head></template>
changed the title [-]v2 breaks vue Style component inside Head component[/-][+]v2 breaks vue Style component inside Head component in Nuxt[/+]on Mar 8, 2025
changed the title [-]v2 breaks vue Style component inside Head component in Nuxt[/-][+]v2 breaks vue Style component inside Head component in Nuxt v3.16[/+]on Mar 8, 2025
The main issue is not the fact that children is not supported anymore, it's that I suddenly can't use Style inside Head anymore. I need to use the weird <component :is="'Style'"/> workaround… Do you have an idea why this is happening?
Your suggestion also only works for me, if I write it as:
<component :is="'Style'">body { background: red }</component>
And if I use <component :is="'Style'">body { background: red }</component> instead of <component :is="'Style'" textContent="body { background: red }" /> I get hydration mismatch warnings: [Vue warn]: Hydration node mismatch
Activity
[-]v2 breaks vue Style component inside Head component[/-][+]v2 breaks vue Style component inside Head component in Nuxt[/+][-]v2 breaks vue Style component inside Head component in Nuxt[/-][+]v2 breaks vue Style component inside Head component in Nuxt v3.16[/+]harlan-zw commentedon Mar 9, 2025
Hi, i'll look at getting this fixed as I think I accidently did drop the
childrensupport for Nuxt 3.16 (on head components).The workaround would be to place the CSS within the tag, this is what the tests are setup for.
Alternatively just use
lehni commentedon Mar 9, 2025
The main issue is not the fact that
childrenis not supported anymore, it's that I suddenly can't useStyleinsideHeadanymore. I need to use the weird<component :is="'Style'"/>workaround… Do you have an idea why this is happening?Your suggestion also only works for me, if I write it as:
<component :is="'Style'">body { background: red }</component>lehni commentedon Mar 9, 2025
And if I use
<component :is="'Style'">body { background: red }</component>instead of<component :is="'Style'" textContent="body { background: red }" />I get hydration mismatch warnings:[Vue warn]: Hydration node mismatchSzymonDziak commentedon Mar 16, 2025
Also error trying to upgrade
fix(vue): restore Style component inside Head and children prop support
fix(vue): restore Style component inside Head and children prop support