Skip to content
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

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

Closed
mod08 opened this issue Jul 1, 2024 · 7 comments
Closed

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

mod08 opened this issue Jul 1, 2024 · 7 comments

Comments

@mod08
Copy link

mod08 commented Jul 1, 2024

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

  • Nuxt 3.12.2 (Starter Template)
@mod08 mod08 changed the title Unkown Type from Plugin after enabling @nuxt/seo Type unkown from Plugin after enabling @nuxt/seo Jul 1, 2024
@asokawotulo
Copy link

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

  • nuxt-seo-experiments/dist/runtime/nuxt/plugins/1.absoluteImageUrls.server
  • nuxt-seo-experiments/dist/runtime/nuxt/plugins/0.routeRules.server
  • nuxt-seo-experiments/dist/runtime/nuxt/plugins/siteConfig
  • nuxt-seo-experiments/dist/runtime/nuxt/plugins/inferSeoMetaPlugin
  • nuxt-simple-robots/dist/runtime/nuxt/plugins/robot-meta.server
  • nuxt-site-config/dist/runtime/nuxt/plugins/i18n.server
  • nuxt-site-config/dist/runtime/nuxt/plugins/0.siteConfig

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

@mhelbich
Copy link

mhelbich commented Jul 5, 2024

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 nuxt/nuxt#24885 and nuxt/module-builder#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
Copy link
Owner

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

@hmd-ali
Copy link

hmd-ali commented Jul 8, 2024

Not sure if this belongs in this category, but the app property in defineNuxtConfig is typed any whenever the @nuxtjs/seo module is enabled
image
image

@CptJJ
Copy link

CptJJ commented Jul 8, 2024

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

Can you elaborate on this fix please?

@harlan-zw
Copy link
Owner

You can delete your lock file + node_modules and then re-install the dependencies, it will automatically update any sub-dependencies using caret version constraints.

@harlan-zw
Copy link
Owner

Okay 2.0.0-rc.12 was pushed out which should fix this.

Not sure if this belongs in this category, but the app property in defineNuxtConfig is typed any whenever the @nuxtjs/seo module is enabled

Would you mind making a new issue for this please 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants