Skip to content

Commit 60dc4e2

Browse files
committed
fix: env on eReputation
1 parent 94ed464 commit 60dc4e2

1 file changed

Lines changed: 23 additions & 24 deletions

File tree

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
11
import { defineConfig } from "vite";
22
import react from "@vitejs/plugin-react";
33
import path from "path";
4-
import { fileURLToPath } from "url";
54
import runtimeErrorOverlay from "@replit/vite-plugin-runtime-error-modal";
65

7-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
6+
const envDir = path.resolve(import.meta.dirname, "../../");
7+
console.log("🔍 Vite envDir:", envDir);
88

9-
const plugins: any[] = [
9+
export default defineConfig(async () => {
10+
const plugins: any[] = [
1011
react(),
1112
runtimeErrorOverlay(),
12-
];
13+
];
1314

14-
// Conditionally add cartographer plugin if in development and REPL_ID is set
15-
if (process.env.NODE_ENV !== "production" && process.env.REPL_ID !== undefined) {
16-
// Use dynamic import at runtime, but handle it synchronously for type checking
17-
// This will be resolved at runtime
18-
plugins.push(
19-
import("@replit/vite-plugin-cartographer").then((m) => m.cartographer()) as any
20-
);
21-
}
15+
if (process.env.NODE_ENV !== "production" && process.env.REPL_ID !== undefined) {
16+
const { cartographer } = await import("@replit/vite-plugin-cartographer");
17+
plugins.push(cartographer());
18+
}
2219

23-
export default defineConfig({
20+
return {
2421
plugins,
2522
resolve: {
26-
alias: {
27-
"@": path.resolve(import.meta.dirname, "client", "src"),
28-
},
23+
alias: {
24+
"@": path.resolve(import.meta.dirname, "client", "src"),
25+
},
2926
},
30-
root: path.resolve(__dirname, "client"),
27+
root: path.resolve(import.meta.dirname, "client"),
3128
build: {
32-
outDir: path.resolve(import.meta.dirname, "dist"),
33-
emptyOutDir: true,
29+
outDir: path.resolve(import.meta.dirname, "dist"),
30+
emptyOutDir: true,
3431
},
3532
server: {
36-
fs: {
37-
strict: true,
38-
deny: ["**/.*"],
39-
},
33+
fs: {
34+
strict: true,
35+
deny: ["**/.*"],
36+
},
4037
},
41-
});
38+
envDir: envDir,
39+
};
40+
});

0 commit comments

Comments
 (0)