-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.js
73 lines (69 loc) · 1.68 KB
/
vite.config.js
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
73
import { defineConfig } from 'vite';
import dns from 'dns';
import eslint from 'vite-plugin-eslint';
import react from '@vitejs/plugin-react';
import tsconfigPaths from 'vite-tsconfig-paths';
import svgr from 'vite-plugin-svgr';
const proxyUrl = process.env.PROXY_URL || 'https://jade.datarepo-dev.broadinstitute.org';
const bigQueryApi = 'https://bigquery.googleapis.com';
const googleSheetsApi = 'https://sheets.googleapis.com';
const driveApi = 'https://www.googleapis.com';
dns.setDefaultResultOrder('verbatim');
const getPlugins = () => {
const plugins = [react(), svgr(), tsconfigPaths()];
if (process.env.DISABLE_ESLINT_PLUGIN !== 'true') {
plugins.push(eslint({ lintOnStart: false }));
}
return plugins;
};
export default defineConfig({
build: {
outDir: 'build',
},
define: {
'process.env': process.env,
},
optimizeDeps: {
entries: ['cypress/**/*'],
},
plugins: getPlugins(),
server: {
port: 3000,
host: 'localhost',
open: true,
watch: {
ignored: ['!**/node_modules/**'],
},
proxy: {
'/api': {
target: proxyUrl,
changeOrigin: true,
},
'/configuration': {
target: proxyUrl,
changeOrigin: true,
},
'/status': {
target: proxyUrl,
changeOrigin: true,
},
'/oauth2': {
target: proxyUrl,
changeOrigin: true,
},
'/bigquery': {
target: bigQueryApi,
changeOrigin: true,
},
'/googlesheets': {
target: googleSheetsApi,
changeOrigin: true,
pathRewrite: { '^/googlesheets': '' },
},
'/drive': {
target: driveApi,
changeOrigin: true,
},
},
},
});