vite.config.ts
1.41 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
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vitest/config';
const rootDir = fileURLToPath(new URL('.', import.meta.url));
const backendOrigin = (process.env.VITE_BACKEND_ORIGIN?.trim() || 'http://127.0.0.1:3002');
export default defineConfig({
plugins: [react()],
server: {
host: true,
port: 4173,
proxy: {
'/api': {
target: backendOrigin,
changeOrigin: true,
},
},
},
preview: {
host: true,
port: 4173,
proxy: {
'/api': {
target: backendOrigin,
changeOrigin: true,
},
},
},
resolve: {
alias: {
'@single-pages/contracts': path.resolve(rootDir, 'packages/contracts/src/index.ts'),
'@single-pages/config': path.resolve(rootDir, 'packages/config/src/index.ts'),
'@single-pages/ui': path.resolve(rootDir, 'packages/ui/src/index.tsx'),
'@single-pages/utils': path.resolve(rootDir, 'packages/utils/src/index.ts'),
},
},
build: {
outDir: 'dist',
sourcemap: true,
rollupOptions: {
input: {
index: path.resolve(rootDir, 'index.html'),
prelearning: path.resolve(rootDir, 'prelearning.html'),
sopMaterialPreview: path.resolve(rootDir, 'sop-material-preview.html'),
},
},
},
test: {
environment: 'jsdom',
setupFiles: ['./src/test/setup.ts'],
},
});