-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
57 lines (56 loc) · 1.54 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
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import viteyaml from '@modyfi/vite-plugin-yaml'
import svgr from 'vite-plugin-svgr'
import pkg from './package.json'
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
dedupe: Object.keys(pkg.dependencies),
},
build: {
manifest: true,
sourcemap: true,
outDir: '../backend/dist',
rollupOptions: {
output: {
manualChunks: (id) => {
if (!id.includes('node_modules')) return // internal
return 'vendor'
let source = id.toString().split('node_modules/')[1].split('/')[0].toString()
let bigones = [
'react-i18next',
'@mui',
'react-dom',
'react-router',
'@remix-run',
'i18next',
]
if (bigones.includes(source)) return `vendor-${source}`
//return source // uncomment to split every vendor dependency
return 'vendor'
},
},
},
},
root: 'frontend',
define: {
__APP_VERSION__: JSON.stringify(process.env.npm_package_version),
},
plugins: [react(), viteyaml(), svgr()],
server: {
proxy: {
'/api': 'http://localhost:5500',
'/oauth2': 'http://localhost:5500',
'/docs': 'http://localhost:5500',
'/redoc': 'http://localhost:5500',
'/openapi.json': 'http://localhost:5500',
},
},
test: {
environment: 'jsdom',
//setupFiles: ['./src/setupTest.jsx'],
testMatch: ['./src/**/*.test.jsx'],
globals: true,
},
})