-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
76 lines (74 loc) · 2.01 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import graphql from "@rollup/plugin-graphql";
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
import react from "@vitejs/plugin-react";
import * as path from "path";
import { defineConfig, loadEnv } from "vite";
import svgr from "vite-plugin-svgr";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
process.env = Object.assign(process.env, loadEnv(mode, process.cwd(), ""));
return defineConfig({
optimizeDeps: {
esbuildOptions: {
tsconfigRaw: {
compilerOptions: {
experimentalDecorators: true
}
}
}
},
plugins: [
svgr({
svgrOptions: {
dimensions: false,
svgoConfig: {
plugins: [{ name: "removeViewBox", active: false }]
}
}
}),
graphql(),
react({
babel: {
plugins: [
"babel-plugin-transform-typescript-metadata",
["@babel/plugin-proposal-decorators", { legacy: true }],
"@babel/plugin-proposal-class-properties"
],
parserOpts: {
plugins: ["decorators-legacy", "classProperties"]
}
}
}),
vanillaExtractPlugin()
],
resolve: {
alias: [
{ find: "@/src", replacement: path.resolve(__dirname, "src") },
{
find: "@/ioc",
replacement: path.resolve(__dirname, "src/shared/ioc")
}
]
},
server: {
port: 3000,
proxy: {
"/s/graphql": {
target: `${process.env.VITE_APP_GRAPHQL_PROXY_ENDPOINT}/api`,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/s\/graphql\//, "")
},
"/rest": {
target: `${process.env.VITE_APP_REST_PROXY_ENDPOINT}`,
changeOrigin: true,
rewrite: (path) => {
console.log(path);
return path.replace(/^\/rest/, "");
}
}
}
}
});
});