38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { defineConfig, configDefaults } from 'vitest/config';
|
|
import react from '@vitejs/plugin-react';
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
const { version } = JSON.parse(
|
|
readFileSync(new URL('./package.json', import.meta.url), 'utf-8'),
|
|
) as { version: string };
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(version),
|
|
},
|
|
css: {
|
|
modules: { localsConvention: 'camelCaseOnly' },
|
|
preprocessorOptions: { scss: { api: 'modern-compiler' } },
|
|
},
|
|
resolve: { alias: { '@': '/src' } },
|
|
server: {
|
|
proxy: {
|
|
// FORGE server runs on 3100 (port 3000 is taken by the time-machine project).
|
|
'/api': 'http://localhost:3100',
|
|
'/healthz': 'http://localhost:3100',
|
|
'/login': 'http://localhost:3100',
|
|
'/logout': 'http://localhost:3100',
|
|
},
|
|
},
|
|
build: { outDir: 'dist', emptyOutDir: true },
|
|
test: {
|
|
environment: 'node',
|
|
include: ['src/**/*.{test,spec}.ts'],
|
|
// Ignore macOS AppleDouble sidecars (`._*`). Syncing the tree to the NAS
|
|
// over SMB/tar can split xattrs into `._foo.test.ts` files whose binary
|
|
// content matches the test glob; esbuild then dies on the leading NUL byte.
|
|
exclude: [...configDefaults.exclude, '**/._*'],
|
|
},
|
|
});
|