This repository has been archived by the owner on Oct 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
/
vite.config.ts
46 lines (43 loc) · 1.39 KB
/
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
38
39
40
41
42
43
44
45
46
import { configDefaults, defineConfig } from 'vitest/config';
import tsconfigPaths from 'vite-tsconfig-paths';
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';
import envCompatible from 'vite-plugin-env-compatible';
const UNLEASH_API = process.env.UNLEASH_API || 'http://localhost:4242';
const UNLEASH_BASE_PATH = process.env.UNLEASH_BASE_PATH || '/';
if (!UNLEASH_BASE_PATH.startsWith('/') || !UNLEASH_BASE_PATH.endsWith('/')) {
console.error('UNLEASH_BASE_PATH must both start and end with /');
process.exit(1);
}
export default defineConfig({
base: UNLEASH_BASE_PATH,
build: {
outDir: 'build',
assetsDir: 'static',
},
test: {
globals: true,
setupFiles: 'src/setupTests.ts',
environment: 'jsdom',
exclude: [...configDefaults.exclude, '**/cypress/**'],
},
server: {
open: true,
host: true,
proxy: {
[`${UNLEASH_BASE_PATH}api`]: {
target: UNLEASH_API,
changeOrigin: true,
},
[`${UNLEASH_BASE_PATH}auth`]: {
target: UNLEASH_API,
changeOrigin: true,
},
[`${UNLEASH_BASE_PATH}logout`]: {
target: UNLEASH_API,
changeOrigin: true,
},
},
},
plugins: [react(), tsconfigPaths(), svgr(), envCompatible()],
});