Files
2026-07-19 18:05:04 +02:00

31 lines
789 B
TypeScript

/// <reference types="vitest/config" />
import { readFileSync } from 'node:fs'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
const pkg = JSON.parse(
readFileSync(new URL('./package.json', import.meta.url), 'utf-8'),
) as { version: string }
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
// Relative base so the built dist/ works from any static host or subpath
// (GitHub Pages, nginx subdirectory, plain file server).
base: './',
define: {
__APP_VERSION__: JSON.stringify(pkg.version),
},
server: {
fs: {
// The bundled example projects live in ../examples at the repo root.
allow: ['..'],
},
},
test: {
environment: 'node',
include: ['src/**/*.test.{ts,tsx}'],
},
})