-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
30 lines (28 loc) · 787 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
import react from '@vitejs/plugin-react'
import { resolve } from 'path'
import { UserConfigExport, defineConfig } from 'vite'
export default ({ mode }: { mode: string }): UserConfigExport => {
// The dev server listens on port 8080, use it during development with vite
if (!process.env['VITE_API_ENDPOINT']) {
if (mode === 'development') {
process.env['VITE_API_ENDPOINT'] = 'http://localhost:8080/api/v1'
} else {
process.env['VITE_API_ENDPOINT'] = ''
}
}
return defineConfig({
plugins: [react()],
root: 'web',
base: process.env['VITE_BASE_PATH'],
build: {
outDir: '../build/web',
emptyOutDir: true,
sourcemap: true,
},
resolve: {
alias: {
'@': resolve(__dirname, '/web'),
},
},
})
}