import { sveltekit } from '@sveltejs/kit/vite'; import { defineConfig, loadEnv } from 'vite'; import { mockApi } from './mocks/plugin'; export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd(), ''); const useMock = env.VITE_USE_MOCK_API === 'true'; return { plugins: [...(useMock ? [mockApi()] : []), sveltekit()], css: { preprocessorOptions: { scss: { // Bootstrap 5.3 is still written against the old Sass API, so // compiling it emits hundreds of warnings we cannot act on. // Drop the list when Bootstrap ships @use-based sources. silenceDeprecations: ['import', 'global-builtin', 'color-functions', 'if-function'] } } }, server: useMock ? {} : { proxy: { '/api': { target: env.VITE_API_PROXY_TARGET || 'http://localhost:8000', changeOrigin: true } } } }; });