sitemap-module-nuxt-3
sitemap-module-nuxt-3 copied to clipboard
nuxt.config.ts sitemap key Typescript error in VSCode
VSCode does not recognize the sitemap key and keeps highlighting it within the nuxt.config.ts file.

Full error:
Argument of type '{ css: string[]; app: { head: { htmlAttrs: { lang: string; }; link: { rel: "preload"; as: "style"; onload: string; href: string; media: string; }[]; script: { hid: string; src: string; defer: true; }[]; }; }; routeRules: { ...; }; ... 5 more ...; sitemap: { ...; }; }' is not assignable to parameter of type 'NuxtConfig'.
Object literal may only specify known properties, and 'sitemap' does not exist in type 'NuxtConfig'.ts(2345)
I think sitemap is the old nuxt2 way.
Try putting it in the modules part:
export default defineNuxtConfig({
modules:
[
[
"@funken-studio/sitemap-nuxt-3",
{
hostname: "https://example.com"
}
]
]
}
);
This worked for me with nuxt 3.0.0. With the current nuxt version 3.1.1 I have a different problem, see #29.
Also see #21.