-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.ts
40 lines (38 loc) · 1020 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
38
39
40
import path from 'path';
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import viteTsconfigPaths from 'vite-tsconfig-paths';
import eslint from 'vite-plugin-eslint';
export default ({ mode }: any) => {
// Load app-level env vars to node-level env vars.
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
return defineConfig({
define: {
'process.env': process.env,
},
plugins: [react(), eslint(), viteTsconfigPaths()],
server: {
open: true, // automatically open the app in the browser
port: parseInt(process.env.PORT ?? '3001'),
},
preview: {
port: parseInt(process.env.PORT ?? '3001'),
},
resolve: {
alias: {
screens: path.resolve(__dirname, './src/screens'),
},
},
build: {
outDir: 'build',
},
// optimizeDeps: {
// force: true,
// esbuildOptions: {
// loader: {
// '.js': 'jsx',
// },
// },
// },
});
};