sitemap-module-nuxt-3 icon indicating copy to clipboard operation
sitemap-module-nuxt-3 copied to clipboard

nuxt.config.ts sitemap key Typescript error in VSCode

Open AlejandroMut opened this issue 2 years ago • 2 comments

VSCode does not recognize the sitemap key and keeps highlighting it within the nuxt.config.ts file.

rsz_1screenshot_2023-01-02_143313

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)

AlejandroMut avatar Jan 02 '23 17:01 AlejandroMut

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.

eggnstone avatar Jan 26 '23 10:01 eggnstone

Also see #21.

eggnstone avatar Jan 26 '23 10:01 eggnstone