-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
vite.config.ts
45 lines (44 loc) · 1.12 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
38
39
40
41
42
43
44
45
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
import eslint from "vite-plugin-eslint";
import istanbul from "vite-plugin-istanbul";
export default defineConfig(({ command, mode }) => {
const env = loadEnv(mode, process.cwd(), "VITE");
return {
// expose all vite "VITE_*" variables as process.env.VITE_* in the browser
define: {
"process.env": env,
},
server: {
port: 3000,
},
build: {
outDir: "build",
sourcemap: true,
},
plugins: [
react(),
eslint(),
istanbul({
cypress: true,
requireEnv: true,
exclude: ["node_modules", "cypress", "dist"],
forceBuildInstrument: true,
}),
],
// to get aws amplify to work with vite
resolve: {
alias: [
{
find: "./runtimeConfig",
replacement: "./runtimeConfig.browser", // ensures browser compatible version of AWS JS SDK is used
},
],
},
test: {
environment: "jsdom",
setupFiles: "./src/setup-tests.js",
exclude: ["node_modules", "cypress", "dist"],
},
};
});