import { defineConfig } from "astro/config";
import svelte from "@astrojs/svelte";
// import astroI18next from "astro-i18next";
import tailwind from "@astrojs/tailwind";
import node from "@astrojs/node";
import mdx from "@astrojs/mdx";

import { fileURLToPath } from "url";

// https://astro.build/config 
export default defineConfig({
  integrations: [svelte(), tailwind(), mdx()],
  outDir: "./dist",
  output: "server",
  vite: {
    optimizeDeps: {
      exclude: ["@ibcornelsen/api", "@ibcornelsen/database"]
    },
    resolve: {
      alias: {
        "#": fileURLToPath(new URL("./src", import.meta.url))
      }
    },
		ssr: {
			noExternal: ["@pdfme/generator", "@pdfme/common", "@pdfme/schemas"]
		},
    build: {
      commonjsOptions: {
        transformMixedEsModules: false
      }
    }
  },
  adapter: node({
    mode: "middleware"
  }),
  server: {
    port: 3000
  }
});