-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
51 lines (50 loc) · 1.86 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
46
47
48
49
50
51
/// <reference types="vitest" />
/// <reference types="vite/client" />
import react from "@vitejs/plugin-react";
import path from "path";
import { defineConfig } from "vite";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
test: {
globals: true,
environment: "jsdom",
setupFiles: "./src/tests/setupTests.ts",
css: true,
// speed up since tests don't rely on css
// https://github.com/vitest-dev/vitest/blob/main/examples/react-testing-lib/vite.config.ts#L14-L16
// css: false,
},
server: {
proxy: {
// Proxying API requests to Mapbox
"/api": {
target: "https://api.mapbox.com",
changeOrigin: true, // needed for virtual hosted sites
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"@app": path.resolve(__dirname, "./src/app"),
"@assets": path.resolve(__dirname, "./src/assets"),
"@components": path.resolve(__dirname, "./src/components"),
"@context": path.resolve(__dirname, "./src/context"),
"@features": path.resolve(__dirname, "./src/features"),
"@hooks": path.resolve(__dirname, "./src/hooks"),
"@layouts": path.resolve(__dirname, "./src/layouts"),
"@lib": path.resolve(__dirname, "./src/lib"),
"@locales": path.resolve(__dirname, "./src/locales"),
"@mock": path.resolve(__dirname, "./src/mock"),
"@models": path.resolve(__dirname, "./src/models"),
"@pages": path.resolve(__dirname, "./src/pages"),
"@routes": path.resolve(__dirname, "./src/routes"),
"@services": path.resolve(__dirname, "./src/services"),
"@store": path.resolve(__dirname, "./src/store"),
"@type-definitions": path.resolve(__dirname, "./src/type-definitions"),
"@utils": path.resolve(__dirname, "./src/utils"),
},
},
});