-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
60 lines (58 loc) · 1.79 KB
/
Copy pathvite.config.ts
File metadata and controls
60 lines (58 loc) · 1.79 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { paraglideVitePlugin } from '@inlang/paraglide-js';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig, loadEnv, type UserConfig } from 'vite';
import UnoCSS from 'unocss/vite';
import { analyzer } from 'vite-bundle-analyzer';
import envCi from 'env-ci';
import { webmanifestPlugin } from './vite-plugins/webmanifest.ts';
import { dotnetWasmAssetPlugin } from './vite-plugins/dotnet-wasm-asset.ts';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
const { isCi } = envCi();
return {
plugins: [
dotnetWasmAssetPlugin(),
UnoCSS(),
sveltekit(),
paraglideVitePlugin({
project: './project.inlang',
outdir: './src/lib/paraglide',
strategy: ['custom-svelteReactiveLocale', 'baseLocale'],
localStorageKey: 'siteLocale',
}),
analyzer({
enabled: !isCi,
analyzerMode: 'static',
exclude: /.+\.(mp4|avif|png|jpg|jpeg|gif|svg)$/,
}),
webmanifestPlugin(),
],
build: {},
// Monaco's worker bootstrap expects module workers; Vite still defaults to 'iife'.
worker: {
format: 'es',
},
// Monaco ships ~1000 modules and 101 stylesheets; prebundling it fights the lazy chunk.
optimizeDeps: {
exclude: ['monaco-editor'],
},
server: {
fs: {
allow: ['wasm'],
},
proxy: {
'/icecast-status': {
target: env.VITE_ICE_CAST,
changeOrigin: true,
secure: true,
rewrite: (path: string) => path.replace(/^\/icecast-status/, '/status-json.xsl'),
},
'/login/token': {
target: env.VITE_API_BASE,
secure: true,
rewrite: (path: string) => path.replace(/^\/login/, '/api/login'),
},
},
},
} as UserConfig;
});