Fix Vite module not found error in production Docker deployments
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
Update Dockerfile to compile server files separately without bundling, preventing Vite dependency issues in production. Includes troubleshooting documentation for the Vite module error. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ceced2fc-aa46-458d-ba87-ddd4b7bb1518 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/659922a9-0087-461c-90dd-6d9a58b81d4d/ceced2fc-aa46-458d-ba87-ddd4b7bb1518/SBF5OKZ
This commit is contained in:
+11
-5
@@ -44,16 +44,22 @@ app.use((req, res, next) => {
|
||||
});
|
||||
|
||||
(async () => {
|
||||
// Dynamically import utilities based on environment
|
||||
// Import utilities based on environment
|
||||
// Use require-style imports to avoid bundler issues
|
||||
let log: (message: string, source?: string) => void;
|
||||
let serveStatic: (app: express.Express) => void;
|
||||
let setupVite: ((app: express.Express, server: any) => Promise<void>) | undefined;
|
||||
|
||||
if (app.get("env") === "development") {
|
||||
const viteModule = await import("./vite");
|
||||
log = viteModule.log;
|
||||
setupVite = viteModule.setupVite;
|
||||
serveStatic = viteModule.serveStatic;
|
||||
try {
|
||||
const viteModule = await import("./vite");
|
||||
log = viteModule.log;
|
||||
setupVite = viteModule.setupVite;
|
||||
serveStatic = viteModule.serveStatic;
|
||||
} catch (error) {
|
||||
console.error("Failed to load vite module:", error);
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
const staticModule = await import("./static");
|
||||
log = staticModule.log;
|
||||
|
||||
Reference in New Issue
Block a user