// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
    compatibilityDate: "2024-11-01",
    ssr: true,
    devtools: { enabled: true },
    css: ["~/assets/css/tailwind.css", "swiper/css", "animate.css/animate.min.css"],

    routeRules: {
        // "/": { swr: 600 },
        // "/product/**" : { swr : 600 },
        // "/article/**" : { swr: 600 },
        "/products": { ssr: false },
        "/profile": { ssr: false },
        "/profile/**": { ssr: false },
    },

    app: {
        pageTransition: {
            name: "fade",
            mode: "out-in",
        },
        head: {
            meta: [
                {
                    name: "mobile-web-app-capable",
                    content: "yes",
                },
                {
                    name: "enamad",
                    content: "13582238",
                },
            ],
            link: [
                {
                    rel: "apple-touch-icon",
                    href: "/logo/apple-icon-180.png",
                },
            ],
        },
    },

    postcss: {
        plugins: {
            "@tailwindcss/postcss": {},
            autoprefixer: {},
        },
    },

    components: [
        {
            path: "~/components",
            pathPrefix: false,
        },
    ],

    icon: {
        mode: "svg",
        provider: undefined,
        customCollections: [
            {
                prefix: "ci",
                dir: "./public/icons",
            },
        ],
        clientBundle: {
            includeCustomCollections: true,
        },
    },

    modules: [
        "@nuxt/icon",
        "reka-ui/nuxt",
        "@vueuse/nuxt",
        "@formkit/auto-animate/nuxt",
        "@vite-pwa/nuxt",
        "@nuxt/image",
        "@nuxtjs/seo",
        "motion-v/nuxt",
    ],

    sitemap: {
        enabled: false,
    },

    pwa: {
        // strategies: "injectManifest",
        // srcDir: "public",
        // filename: "sw.js",
        // registerType: process.env.NODE_ENV === "production" ? "autoUpdate" : "prompt",
        manifest: {
            name: "Heymlz",
            short_name: "Heymlz",
            theme_color: "#ffffff",
            icons: [
                {
                    src: "/logo/manifest-icon-192.maskable.png",
                    sizes: "192x192",
                    type: "image/png",
                    purpose: "any",
                },
                {
                    src: "/logo/manifest-icon-192.maskable.png",
                    sizes: "192x192",
                    type: "image/png",
                    purpose: "maskable",
                },
                {
                    src: "/logo/manifest-icon-512.maskable.png",
                    sizes: "512x512",
                    type: "image/png",
                    purpose: "any",
                },
                {
                    src: "/logo/manifest-icon-512.maskable.png",
                    sizes: "512x512",
                    type: "image/png",
                    purpose: "maskable",
                },
            ],
        },
        workbox: {
            navigateFallback: "/",
            clientsClaim: true,
            skipWaiting: true,
        },
        devOptions: {
            enabled: process.env.NODE_ENV === "production",
            type: "module",
        },
    },

    typescript: {
        typeCheck: false,
    },

    image: {
        quality: 65,
    },

    runtimeConfig: {
        public: {
            API_BASE_URL: process.env.API_BASE_URL,
        },
    },
});
