-
Notifications
You must be signed in to change notification settings - Fork 5
/
vite.config.ts
37 lines (30 loc) · 1.06 KB
/
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
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig, loadEnv } from "vite";
// eslint-disable-next-line import/no-extraneous-dependencies
import react from "@vitejs/plugin-react-swc";
import tsconfigPaths from "vite-tsconfig-paths";
/**
* REACT_APP_ 으로 시작하는 환경변수를
* import.meta.env.REACT_APP_{변수명} 으로 사용할 수 있습니다.
* @see https://vitejs.dev/config/shared-options.html#envprefix
*/
export const envPrefix = "REACT_APP_";
/**
* vite 프로젝트 설정 파일
*
* @see https://vitejs.dev/config/
*/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
const port = parseInt(env.PORT, 10);
return {
/** @see https://vitejs.dev/plugins/ */
plugins: [react(), tsconfigPaths()],
envPrefix,
/** @see https://vitejs.dev/config/server-options.html#server-port */
server: { port, strictPort: true, host: true },
/** @see https://vitejs.dev/config/build-options.html#build-outdir */
build: { outDir: "build" },
base: "./",
};
});