harlan-zw / nuxt-seo

The complete SEO solution for Nuxt.
https://nuxtseo.com
957 stars 56 forks source link

Type unkown from Plugin after enabling @nuxt/seo #260

Open mod08 opened 6 days ago

mod08 commented 6 days ago

Describe the bug

As soon as I add the @nuxtjs/seo Module to an empty Nuxt Project the Type of my provided Plugin Variable becomes unkown.

Since i wasn't able to reliable reproduce this in Stackblitz i created this short video.

nuxt-seo-type-unkown

Reproduction

No response

System / Nuxt Info

asokawotulo commented 3 days ago

I'm experiencing the same issue. I did a bit of digging and it looks like when Nuxt is trying to inject the plugins, the following plugin files do not have a default return value

My temporary workaround is to comment those lines in .nuxt/types/plugins.d.ts

mhelbich commented 1 day ago

Can confirm this is happening to me too.

Some info: Nuxt version 3.12.3 (although it also happened with 3.12.2 as mentioned above) @nuxtjs/seo: ^2.0.0-rc.11

With the module enabled: image image

With the module disabled: image image

And I can also confirm that commenting out the plugin declarations that @asokawotulo mentioned resolves the issue. image ($caFetch is no longer unknown with this) -> The issue with this is though, that Nuxt will often times replace this generated file.

I was browsing through https://github.com/nuxt/nuxt/issues/24885 and https://github.com/nuxt/module-builder/issues/215 as well as some mentions of the "plugin type unknown" on the Nuxt Discord, but wasn't able to find anything else to get it to work.

harlan-zw commented 4 hours ago

I've updated all of these plugins, for some reason the nuxt-module-builder is failing when importing defineNuxtApp from #imports.

I'll try sort out a Nuxt SEO release soon but you can bump your lock file to get the fixes too