// @ts-check
import { defineConfig, envField } from 'astro/config';
import { fileURLToPath } from 'node:url';

import solidJs from "@astrojs/solid-js";
import mdx from "@astrojs/mdx";
import tailwindcss from '@tailwindcss/vite';
import { ViteToml } from "vite-plugin-toml";

// https://astro.build/config
export default defineConfig({
    i18n: {
        locales: ["en", "th"],
        defaultLocale: "en",
        routing: {
            prefixDefaultLocale: true,
            redirectToDefaultLocale: false
        }
    },

    env: {
        schema: {
            // Example value: https://movetolinux.example.com
            // If unset, code will use Astro.url.host instead, which is most likely "http://localhost:4321"
            ORIGIN: envField.string({ context: "server", access: "public", optional: true })
        }
    },

    vite: {
        // @ts-ignore
        plugins: [tailwindcss(), ViteToml()],
        resolve: {
            alias: {
                "@": fileURLToPath(new URL("./src", import.meta.url))
            }
        },
    },

    integrations: [solidJs(), mdx()]
});