Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
75 lines (72 loc) · 2.04 KB
/
Copy pathvite.config.ts
File metadata and controls
75 lines (72 loc) · 2.04 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
import react from '@vitejs/plugin-react';
import path from 'path';
import { defineConfig, loadEnv } from 'vite';
import svgr from 'vite-plugin-svgr';
const API_PORT = process.env.PORT || '5055';
const API_HOST = process.env.HOST || '127.0.0.1';
const PUBLIC_BASE = process.env.FORESEERR_BASE_PATH ? './' : '/';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
const commitTag = env.COMMIT_TAG || process.env.COMMIT_TAG || 'local';
return {
plugins: [
react(),
svgr({
include: '**/*.svg',
svgrOptions: {
exportType: 'default',
},
}),
],
define: {
'import.meta.env.COMMIT_TAG': JSON.stringify(commitTag),
},
resolve: {
alias: {
'@app': path.resolve(__dirname, 'src'),
'@server': path.resolve(__dirname, 'server'),
// The package "module" entry is ESM that still calls require() for
// dayjs locales/plugins. Force the CJS build so Rollup rewrites them.
'@seerr-team/react-tailwindcss-datepicker': path.resolve(
__dirname,
'node_modules/@seerr-team/react-tailwindcss-datepicker/dist/index.cjs.js'
),
},
},
publicDir: 'public',
base: PUBLIC_BASE,
build: {
outDir: 'dist/public',
emptyOutDir: true,
sourcemap: true,
commonjsOptions: {
transformMixedEsModules: true,
},
},
optimizeDeps: {
include: ['@seerr-team/react-tailwindcss-datepicker', 'dayjs'],
},
server: {
port: 3000,
strictPort: true,
proxy: {
'/api': {
target: `http://${API_HOST}:${API_PORT}`,
changeOrigin: true,
},
'/imageproxy': {
target: `http://${API_HOST}:${API_PORT}`,
changeOrigin: true,
},
'/avatarproxy': {
target: `http://${API_HOST}:${API_PORT}`,
changeOrigin: true,
},
'/api-docs': {
target: `http://${API_HOST}:${API_PORT}`,
changeOrigin: true,
},
},
},
};
});