import { fileURLToPath, URL } from 'node:url' import tailwindcss from '@tailwindcss/vite' import vue from '@vitejs/plugin-vue' // vitest/config's defineConfig is vite's own, augmented with the `test` // field's types — importing from here (not 'vite') is what lets the // `test` block below type-check under vue-tsc -b without a separate // vitest.config.ts or a triple-slash type reference. import { defineConfig } from 'vitest/config' import { mockAdminApi } from './mock/server.ts' import { themeBoot } from './vite-plugins/theme-boot.ts' // MOCK=1 serves /admin/api/* from webui/mock (dev server only; apply: 'serve' keeps it out of vite build). const useMock = process.env.MOCK === '1' // Keep identical to adminCSP in ../admin.go: `vite preview` serves the built dist under it so a CSP violation shows up in the browser console. const ADMIN_CSP = "default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; frame-ancestors 'none'; base-uri 'none'; form-action 'none'" // https://vite.dev/config/ export default defineConfig({ // admin.go serves this build's index.html at GET /admin and every hashed // asset at GET /admin/assets/{hashedname} — the base must match so the // emitted index.html's own