Files
hnefatafl/vite.config.ts

27 lines
813 B
TypeScript

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)
},
// A static build: Caddy serves files and proxies /api and /ws to the game server.
adapter: adapter({ fallback: 'index.html' })
})
],
server: {
// In development the game server runs beside Vite; in production Caddy does this.
proxy: {
'/api': 'http://localhost:8789',
'/ws': { target: 'ws://localhost:8789', ws: true }
}
},
test: {
include: ['src/**/*.test.ts']
}
});