-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvite.config.ts
56 lines (53 loc) · 1.36 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
import { fileURLToPath, URL } from "url";
import { defineConfig, type ProxyOptions, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import basicSsl from "@vitejs/plugin-basic-ssl";
import { createRequire } from "node:module";
//import ckeditor5 from "@ckeditor/vite-plugin-ckeditor5";
const require = createRequire(import.meta.url);
const proxyCalls = [
"/api",
"/signin-oidc",
"/signout-callback-oidc",
"/healthz",
];
const getProxy = (
env?: Record<string, string>,
): Record<string, ProxyOptions> | undefined => {
const targetPort = env?.BFF_SSL_PORT;
if (!targetPort) return undefined;
const redirectOpts: ProxyOptions = {
target: `http://localhost:${targetPort}`,
secure: false,
headers: {
"x-forwarded-proto": "https",
},
};
return Object.fromEntries(proxyCalls.map((key) => [key, redirectOpts]));
};
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env =
mode === "development" ? loadEnv(mode, process.cwd(), "") : undefined;
const proxy = env && getProxy(env);
return {
plugins: [vue(), basicSsl()],
server: {
port: 3000,
proxy,
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
build: {
assetsInlineLimit: 0,
},
test: {
coverage: {
all: true,
},
},
};
});