-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathvite.config.mjs
More file actions
96 lines (94 loc) · 2.48 KB
/
vite.config.mjs
File metadata and controls
96 lines (94 loc) · 2.48 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import commonjs from 'vite-plugin-commonjs'
import eslint from 'vite-plugin-eslint'
import path from 'path'
import react from '@vitejs/plugin-react-swc'
import svgr from 'vite-plugin-svgr'
import { defineConfig, loadEnv } from 'vite'
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, path.resolve(process.cwd()), '')
return {
plugins: [commonjs(), react(), svgr(), eslint({ failOnError: false })],
base: env.NODE_ENV === 'production' ? env.VITE_PUBLIC_URL : '/',
server: {
proxy: {
'/api': env.VITE_MLRUN_API_URL
? {
target: env.VITE_MLRUN_API_URL,
changeOrigin: true,
headers: {
Connection: 'keep-alive',
'x-v3io-session-key': env.VITE_MLRUN_V3IO_ACCESS_KEY,
'x-remote-user': 'admin'
}
}
: undefined,
'/nuclio': env.VITE_NUCLIO_API_URL
? {
target: env.VITE_NUCLIO_API_URL,
changeOrigin: true,
rewrite: path => path.replace(/^\/nuclio/, '')
}
: undefined,
'/iguazio': env.VITE_IGUAZIO_API_URL
? {
target: env.VITE_IGUAZIO_API_URL,
changeOrigin: true,
rewrite: path => path.replace(/^\/iguazio/, '')
}
: undefined,
'/function-catalog': env.VITE_FUNCTION_CATALOG_URL
? {
target: env.VITE_FUNCTION_CATALOG_URL,
changeOrigin: true,
rewrite: path => path.replace(/^\/function-catalog/, '')
}
: undefined
},
fs: {
strict: false
},
hmr: {
protocol: 'ws'
},
port: 3000
},
resolve: {
alias: {
'igz-controls': path.resolve(
__dirname,
'node_modules/iguazio.dashboard-react-controls/dist'
)
},
dedupe: [
'react',
'react-dom',
'classnames',
'final-form',
'final-form-arrays',
'lodash',
'prop-types',
'react-final-form',
'react-final-form-arrays',
'react-modal-promise',
'react-transition-group'
]
},
optimizeDeps: {
force: true
},
build: {
sourcemap: true,
outDir: 'build',
chunkSizeWarningLimit: 3000
},
css: {
devSourcemap: true,
preprocessorOptions: {
scss: {
sourceMap: true,
api: 'modern'
}
}
}
}
})