-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvite.config.ts
More file actions
35 lines (32 loc) · 1.16 KB
/
vite.config.ts
File metadata and controls
35 lines (32 loc) · 1.16 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
import react from '@vitejs/plugin-react'
import { defineConfig, loadEnv } from 'vite'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
// suppress eslint warning that process isn't defined (it is)
// eslint-disable-next-line
const env = { ...loadEnv(mode, process.cwd(), '') };
if(env.EXTRA_VERBOSE === 'true') {
console.log(`[WEB-APP] loaded env: ${JSON.stringify(env)}`);
}
// reusable config for both server and preview
const serverConfig = {
host: env.WEB_APPLICATION_HOST || '0.0.0.0',
port: Number(env.WEB_APPLICATION_PORT),
strictPort: true,
allowedHosts: ["simple.local", env.WEB_HOSTNAME+".local"],
};
return {
plugins: [react()],
preview: serverConfig,
server: serverConfig,
optimizeDeps: {
exclude: ["@yume-chan/adb-scrcpy", "@yume-chan/stream-extra"],
},
define: {
'process.env.MONITOR_WS_PORT': JSON.stringify(env.MONITOR_WS_PORT),
'process.env.HEADSETS_IP' : JSON.stringify(env.HEADSETS_IP),
'process.env.ENV_MAX_ELEMENTS' : JSON.stringify(env.ENV_MAX_ELEMENTS),
'process.env.IMAGE_SOURCE_FOLDER' : JSON.stringify(env.IMAGE_SOURCE_FOLDER)
}
};
})