-
Notifications
You must be signed in to change notification settings - Fork 422
Expand file tree
/
Copy pathvite.config.ts
More file actions
72 lines (70 loc) · 2.22 KB
/
Copy pathvite.config.ts
File metadata and controls
72 lines (70 loc) · 2.22 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
61
62
63
64
65
66
67
68
69
70
71
72
import path from 'path'
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react-swc'
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
const BASE_URL = process.env.BASE_URL ?? ''
const BASE = BASE_URL == null || BASE_URL === '' ? '/' : BASE_URL
// https://vitejs.dev/config/
export default defineConfig({
base: BASE,
resolve: {
alias: [
{ find: '~', replacement: path.resolve(__dirname, './src') },
{
find: '@components',
replacement: path.resolve(__dirname, './src/library/components'),
},
{ find: '@hooks', replacement: path.resolve(__dirname, './src/hooks') },
{ find: '@utils', replacement: path.resolve(__dirname, './src/utils') },
{ find: '@models', replacement: path.resolve(__dirname, './src/models') },
{ find: '@api', replacement: path.resolve(__dirname, './src/api') },
{
find: '@context',
replacement: path.resolve(__dirname, './src/context'),
},
{ find: '@tests', replacement: path.resolve(__dirname, './src/tests') },
],
},
assetsInclude: ['**/*.woff', '**/*.woff2', '**/*.ttf', '**/*.otf'],
build: {
outDir: 'dist',
modulePreload: false,
},
define: {
__BASE_URL__: JSON.stringify(BASE_URL),
__IS_HEADLESS__: JSON.stringify(Boolean(process.env.IS_HEADLESS ?? false)),
},
plugins: [react(), cssInjectedByJsPlugin()],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./src/tests/setup.ts'],
exclude: ['**/node_modules/**', './tests'],
},
server:
process.env.NODE_ENV === 'testing'
? {}
: {
proxy: {
[`${BASE_URL}/api`]: {
target: 'http://api:8000',
rewrite: path => path.replace(`${BASE_URL}/api`, '/api'),
},
[`${BASE_URL}/data-catalog`]: {
target: 'http://app:8001',
rewrite: path => BASE,
},
[`${BASE_URL}/data`]: {
target: 'http://app:8001',
rewrite: path => BASE,
},
[`${BASE_URL}/lineage`]: {
target: 'http://app:8001',
rewrite: path => BASE,
},
},
},
preview: {
port: 8005,
},
})