-
Notifications
You must be signed in to change notification settings - Fork 4
/
vite.config.build.ts
42 lines (37 loc) · 1.15 KB
/
vite.config.build.ts
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
import type { BuildOptions, ServerOptions } from 'vite'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import apiDomain from './src/api/url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const config: { server: ServerOptions, build: BuildOptions } = {
server: {
port: 7779,
host: '0.0.0.0',
proxy: {
'/api': {
target: apiDomain,
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/api/, '/api'),
configure: (proxy, _options) => {
proxy.on('proxyReq', (proxyReq, req, _res) => {
proxyReq.setHeader('X-Real-IP', req.socket.remoteAddress || 'unknown')
})
},
},
},
},
build: {
target: 'es2018',
cssTarget: 'chrome79',
minify: true,
assetsInlineLimit: 4096,
chunkSizeWarningLimit: 1000,
outDir: 'dist',
rollupOptions: {
input: {
main: path.resolve(__dirname, 'index.html'),
},
},
},
}
export default config