kinaiok commited on
Commit
e43088b
·
1 Parent(s): c5b14b4

fix: Use default values for PORT and BASE_PATH in vite config

Browse files
Files changed (1) hide show
  1. artifacts/image-gen/vite.config.ts +3 -15
artifacts/image-gen/vite.config.ts CHANGED
@@ -4,27 +4,15 @@ import tailwindcss from "@tailwindcss/vite";
4
  import path from "path";
5
  import runtimeErrorOverlay from "@replit/vite-plugin-runtime-error-modal";
6
 
7
- const rawPort = process.env.PORT;
8
-
9
- if (!rawPort) {
10
- throw new Error(
11
- "PORT environment variable is required but was not provided.",
12
- );
13
- }
14
-
15
  const port = Number(rawPort);
16
 
17
  if (Number.isNaN(port) || port <= 0) {
18
  throw new Error(`Invalid PORT value: "${rawPort}"`);
19
  }
20
 
21
- const basePath = process.env.BASE_PATH;
22
-
23
- if (!basePath) {
24
- throw new Error(
25
- "BASE_PATH environment variable is required but was not provided.",
26
- );
27
- }
28
 
29
  export default defineConfig({
30
  base: basePath,
 
4
  import path from "path";
5
  import runtimeErrorOverlay from "@replit/vite-plugin-runtime-error-modal";
6
 
7
+ // 在生產環境建置時使用預設值
8
+ const rawPort = process.env.PORT || "7860";
 
 
 
 
 
 
9
  const port = Number(rawPort);
10
 
11
  if (Number.isNaN(port) || port <= 0) {
12
  throw new Error(`Invalid PORT value: "${rawPort}"`);
13
  }
14
 
15
+ const basePath = process.env.BASE_PATH || "/";
 
 
 
 
 
 
16
 
17
  export default defineConfig({
18
  base: basePath,