a73x

web/vite.config.ts

Ref:   Size: 1.0 KiB   History

import adapter from '@sveltejs/adapter-static';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';

export default defineConfig({
	plugins: [
		sveltekit({
			compilerOptions: {
				// Force runes mode for the project, except for libraries. Can be removed in svelte 6.
				runes: ({ filename }) =>
					filename.split(/[/\\]/).includes('node_modules') ? undefined : true
			},

			// Static SPA: the Go server embeds this build and serves index.html
			// for all client-routed paths (see internal/server/web).
			adapter: adapter({ fallback: 'index.html' })
		})
	],
	server: {
		proxy: {
			'/api': 'http://localhost:8080'
		}
	},
	// Console logic is tested where it lives: the same plugin pipeline compiles
	// the .svelte.ts modules for the test run, so a test imports the real export
	// rather than a copy of it. Node environment — the rules under test are
	// pure, and the modules that do touch the DOM guard on `typeof window`.
	test: {
		environment: 'node',
		include: ['src/**/*.test.ts']
	}
});