forked from masslight/ottehr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
37 lines (34 loc) · 954 Bytes
/
vite.config.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
import react from '@vitejs/plugin-react';
import browserslistToEsbuild from 'browserslist-to-esbuild';
import * as path from 'path';
import { defineConfig, loadEnv } from 'vite';
import svgr from 'vite-plugin-svgr';
import viteTsconfigPaths from 'vite-tsconfig-paths';
import dotenv from 'dotenv';
dotenv.config();
export default ({ mode }) => {
const envDir = './env';
const env = loadEnv(mode, path.join(process.cwd(), envDir), '');
return defineConfig({
envDir: envDir,
publicDir: 'public',
plugins: [react(), viteTsconfigPaths(), svgr()],
server: {
open: true,
port: env.PORT ? parseInt(env.PORT) : undefined,
},
optimizeDeps: {
exclude: ['js-big-decimal', 'jsonpath-plus'],
},
build: {
outDir: './build',
target: browserslistToEsbuild(),
rollupOptions: {
external: ['jsonpath-plus'],
},
},
define: {
'process.env': process.env,
},
});
};