-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathvite.config.js
45 lines (43 loc) · 1.21 KB
/
vite.config.js
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
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable no-underscore-dangle */
/// <reference types="vitest" />
import path, { dirname } from "path";
import { fileURLToPath } from "url";
import react from "@vitejs/plugin-react";
import million from "million/compiler";
import { defineConfig, loadEnv } from "vite";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
return {
define: {
"process.env.REACT_APP_API_BASE_URL": JSON.stringify(
env.REACT_APP_API_BASE_URL
),
},
plugins: [million.vite({ auto: true }), react()],
test: {
environment: "jsdom",
include: ["**/*.test.[jt]s?(x)"],
exclude: [
"**/node_modules/**",
"**/dist/**",
"**/.{idea,git,cache,output,temp}/**",
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*",
],
globals: true,
},
server: {
watch: {
usePolling: true,
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
};
});