internal/webui carries web/'s build (written to internal/webui/dist by Vite, git-ignored) when sondad is built with -tags webui. Without the tag the app is absent and a plain go build and go test still work with no Node. main wires it into the router.
29 lines
923 B
TypeScript
29 lines
923 B
TypeScript
/// <reference types="vitest/config" />
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { defineConfig } from 'vite'
|
|
|
|
// The dev server proxies /api to a running sondad; set SONDA_URL to point elsewhere.
|
|
const target = process.env.SONDA_URL ?? 'http://127.0.0.1:8080'
|
|
|
|
export default defineConfig({
|
|
plugins: [react(), tailwindcss()],
|
|
resolve: {
|
|
alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) },
|
|
},
|
|
// The build goes where the Go server embeds it (build sondad with -tags webui). It is outside the web
|
|
// folder, so Vite has to be told that it may empty it.
|
|
build: {
|
|
outDir: '../internal/webui/dist',
|
|
emptyOutDir: true,
|
|
},
|
|
server: {
|
|
proxy: { '/api': { target, changeOrigin: false } },
|
|
},
|
|
test: {
|
|
environment: 'jsdom',
|
|
setupFiles: ['./src/test/setup.ts'],
|
|
css: false,
|
|
},
|
|
})
|