{% if use_tailwind %}
import tailwindcss from "@tailwindcss/vite";
{% endif %}

// Litestar manages the dev server port via VITE_PORT and runtime config.
// The Nuxt module reads the port automatically - no hardcoding needed.
// LITESTAR_PORT is the backend API server port (default {{ litestar_port }}).
const LITESTAR_PORT = process.env.LITESTAR_PORT ?? "{{ litestar_port }}";

export default defineNuxtConfig({
  compatibilityDate: "2024-11-01",
  devtools: { enabled: true },
  modules: ["litestar-vite-plugin/nuxt"],
{% if use_tailwind %}
  css: ["~/assets/css/tailwind.css"],
  vite: {
    plugins: [tailwindcss()],
  },
{% endif %}
  litestar: {
    // API proxy points to the Litestar backend (apiPrefix defaults to "/api")
    apiProxy: `http://127.0.0.1:${LITESTAR_PORT}`,
{% if enable_types %}
    types: true,
{% endif %}
  },
});
