summaryrefslogtreecommitdiff
path: root/frontend/vite.config.ts
blob: 8c4876682dd619e99460b9dc5ee17a5047063126 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { defineConfig } from 'vitest/config';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import tailwindcss from '@tailwindcss/vite';
import path from 'node:path';

export default defineConfig({
    plugins: [svelte(), tailwindcss()],
    // resolve svelte's browser (client) build so tests can actually mount
    // components; production client bundles already resolve the same entry
    resolve: {
        conditions: ['browser'],
        alias: { $lib: path.resolve(process.cwd(), 'src/lib') }
    },
    build: { target: 'es2020' },
    test: {
        environment: 'jsdom',
        include: ['src/**/*.test.ts'],
        // geometry shim: jsdom lacks Range.getClientRects which CodeMirror's
        // measurement layer needs (narrow; see src/test-setup.ts)
        setupFiles: ['./src/test-setup.ts'],
        // let vitest resolve the browser (client) build of svelte so component
        // mounting is possible in jsdom regression tests
        resolve: { conditions: ['browser'] }
    } as never,
    server: {
        proxy: {
            '/api': {
                target: 'http://127.0.0.1:8787',
                changeOrigin: true
            }
        }
    }
});