-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfarm.config.ts
46 lines (42 loc) · 1.04 KB
/
farm.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
import { defineConfig } from "@farmfe/core";
import farmPostcssPlugin from "@farmfe/js-plugin-postcss";
import path from "path";
export default defineConfig((cfg) => {
let env: object | undefined;
if (cfg.mode !== "development") {
env = {
SD_BACKEND_URL: process.env.SD_BACKEND_URL,
SD_CLIENT_ID: process.env.SD_CLIENT_ID,
SD_AUTHORITY_URL: process.env.SD_AUTHORITY_URL,
};
for (const [key, value] of Object.entries(env)) {
if (!value) {
throw new Error(`Environment variable ${key} is missing or empty.`);
}
}
}
return {
plugins: ["@farmfe/plugin-react", farmPostcssPlugin()],
compilation: {
resolve: {
alias: {
"~/": path.join(process.cwd(), "src"),
}
},
define: env,
},
envPrefix: "SD_",
server: {
proxy: {
"/auth": {
target: "http://localhost:8000",
changeOrigin: true
},
"/v2": {
target: "http://localhost:8000",
changeOrigin: true
}
}
}
};
});