unjs / unhead

Unhead is the any-framework document head manager built for performance and delightful developer experience.
https://unhead.unjs.io
MIT License
608 stars 41 forks source link

Doesn't seem to work properly under #301

Closed nijinekoyo closed 9 months ago

nijinekoyo commented 9 months ago

Environment

"@unhead/vue": "^1.8.9"
"vite": "^4.5.0"
"vue": "^3.3.8"
"vue-router": "^4.2.5"

Reproduction

Neither useHead nor useSeoMeta works properly

Describe the bug

After I updated vite to 4.5.0 (I also updated many packages at the same time, I am not sure if this is the problem) neither useHead nor useSeoMeta can work properly. They can modify the head normally in dev mode. However, after building to production in SPA mode, the code no longer works properly, and no tags under the head are modified.

Additional context

No response

Logs

No errors were generated
harlan-zw commented 9 months ago

Hi, I'll need a reproduction to help with you debug this. Unhead was working fine in Nuxt when it was using this version.

nijinekoyo commented 9 months ago

Sorry I'm using this package on a closed source project and I don't know how to reproduce the same issue on other projects

nijinekoyo commented 9 months ago

The following is the code that is causing the problem

<script setup lang="ts">
import { useHead } from '@unhead/vue'

useHead({
    meta: [
        { name: 'status-code', content: '404' },
    ],
})
</script>
nijinekoyo commented 9 months ago

Oh, I understand, it’s because I directly executed the createHead() registration in main.ts instead of mounting it under createApp().use()

nijinekoyo commented 9 months ago

It seemed to work fine in older versions, but I don't know when it stopped working.

Pajicc commented 8 months ago

I have the same issue, locally it works (in chrome extension - social share preview), but on production none of the meta tags are working properly (they are there though). "vue": "^3.2.47", "vite": "^4.1.4", "@unhead/vue": "^1.8.9".

I'm using the package normally as showed documentation.

nijinekoyo commented 8 months ago

I have the same issue, locally it works (in chrome extension - social share preview), but on production none of the meta tags are working properly (they are there though). "vue": "^3.2.47", "vite": "^4.1.4", "@unhead/vue": "^1.8.9".

I'm using the package normally as showed documentation.

https://unhead.unjs.io/setup/vue/installation#demos You can refer to this step to check whether the configuration is correct.

FredericGaudreau commented 4 months ago

I also have the same issue as @Pajicc. I checked the link above, but it did not fix my problem. Meta tags are there but ignored.