-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
51 lines (49 loc) · 1.79 KB
/
Copy pathvite.config.ts
File metadata and controls
51 lines (49 loc) · 1.79 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
/// <reference types="vitest/config" />
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import { fileURLToPath, URL } from 'node:url';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
return {
plugins: [react()],
resolve: mode !== 'test' ? {
// Unit and visual tests can explicitly exercise prototype screens, but a
// deployable bundle must not contain invented strategies, bots or alerts.
alias: {
'../data/mockData': fileURLToPath(new URL('./src/data/productionFixtureGuard.ts', import.meta.url)),
},
} : undefined,
build: {
rolldownOptions: {
output: {
codeSplitting: {
groups: [{
name: 'three-vendor',
maxSize: 450_000,
test: /node_modules[\\/]three[\\/]/,
}],
},
},
},
},
server: env.VITE_REAL_API_TARGET ? {
proxy: {
// The backtest read surface lives on backtest-api, not backend-api.
// The more specific rule wins, so only /api/v1/backtests leaves the
// backend target; everything else keeps its single-origin path.
...(env.VITE_BACKTEST_API_TARGET ? {
'/api/v1/backtests': { target: env.VITE_BACKTEST_API_TARGET, changeOrigin: true },
} : {}),
'/api': { target: env.VITE_REAL_API_TARGET, changeOrigin: true },
'/actuator': { target: env.VITE_REAL_API_TARGET, changeOrigin: true },
},
} : undefined,
test: {
environment: 'jsdom',
setupFiles: './src/test/setup.ts',
// The default 5s cuts off the longer launch flows on slower machines,
// and a test killed mid-flow leaks editor draft state into later tests.
testTimeout: 15000,
},
};
});