// Path: Frontend/vite.config.ts

import { solidStart } from "@solidjs/start/config";
import { nitroV2Plugin as nitro } from "@solidjs/vite-plugin-nitro-2";
import { defineConfig } from "vite";

const extraAllowedHosts = (process.env.ALLOWED_HOSTS ?? "")
	.split(",")
	.map((host) => host.trim())
	.filter(Boolean);

export default defineConfig({
	plugins: [solidStart(), nitro()],
	server: {
		allowedHosts: ["localhost", ...extraAllowedHosts],
	},
	preview: {
		allowedHosts: ["localhost", ...extraAllowedHosts],
	},
	css: {
		preprocessorOptions: {
			scss: {
				additionalData: `@use "/src/styles/vars" as *; \n`,
			},
		},
	},
});
