import path from 'node:path'; import process from 'node:process'; import adapter from '@sveltejs/adapter-static'; import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; // OUT_DIR is set by Cargo at build time: // // // When we're building through `vite` directly, it will not be set; we use "target" as a generic // output directory to keep all the build products in one place. const outDir = process.env['OUT_DIR'] ?? 'target'; /** @type {import('@sveltejs/kit').Config} */ const config = { kit: { adapter: adapter({ pages: path.join(outDir, 'ui'), fallback: 'index.html', }), files: { hooks: { universal: 'ui/hooks', server: 'ui/hooks.server', client: 'ui/hooks.client', }, assets: 'ui/static', lib: 'ui/lib', params: 'ui/params', routes: 'ui/routes', serviceWorker: 'ui/service-worker', appTemplate: 'ui/app.html', errorTemplate: 'ui/error.html', }, outDir: path.join(outDir, 'svelte-kit'), }, preprocess: vitePreprocess(), }; export default config;