-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
37 lines (31 loc) · 1002 Bytes
/
vite.config.ts
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
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import { viteSingleFile } from 'vite-plugin-singlefile';
import dotenv from 'dotenv';
dotenv.config();
// Define required environment variables
const requiredEnvVars = ['VITE_WS_PORT', 'VITE_APP_TITLE', 'VITE_APP_RE'] as const;
const missingEnvVars = requiredEnvVars.filter(varName => !process.env[varName]);
if (missingEnvVars.length > 0) {
console.error(`Missing required environment variables: ${missingEnvVars.join(', ')}`);
process.exit(1);
}
const processEnv: Record<string, string | undefined> = requiredEnvVars.reduce((acc, varName) => {
acc[varName] = process.env[varName];
return acc;
}, {} as Record<string, string | undefined>);
// https://vite.dev/config/
export default defineConfig({
plugins: [
svelte(),
viteSingleFile(),
],
define: {
'process.env': processEnv,
},
build: {
target: 'esnext',
assetsInlineLimit: 100000000,
outDir: 'dist'
},
});