Fix Docker deployment by resolving module resolution errors
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
Update build process and imports to ensure Node.js ESM compatibility for Docker deployments, addressing ERR_MODULE_NOT_FOUND errors by separating server compilation and adding .js extensions to all relative imports. 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:
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { drizzle } from 'drizzle-orm/node-postgres';
|
||||
import { Pool } from 'pg';
|
||||
import { migrate } from 'drizzle-orm/node-postgres/migrator';
|
||||
import * as schema from '@shared/schema';
|
||||
import * as schema from '../shared/schema.js';
|
||||
import { sql } from 'drizzle-orm';
|
||||
|
||||
let db: ReturnType<typeof drizzle> | null = null;
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
import express, { type Request, Response, NextFunction } from "express";
|
||||
import { registerRoutes } from "./routes";
|
||||
import { initializeDatabase, closeDatabase } from "./db";
|
||||
import { registerRoutes } from "./routes.js";
|
||||
import { initializeDatabase, closeDatabase } from "./db.js";
|
||||
|
||||
const app = express();
|
||||
app.use(express.json());
|
||||
@@ -52,7 +52,7 @@ app.use((req, res, next) => {
|
||||
|
||||
if (app.get("env") === "development") {
|
||||
try {
|
||||
const viteModule = await import("./vite");
|
||||
const viteModule = await import("./vite.js");
|
||||
log = viteModule.log;
|
||||
setupVite = viteModule.setupVite;
|
||||
serveStatic = viteModule.serveStatic;
|
||||
@@ -61,7 +61,7 @@ app.use((req, res, next) => {
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
const staticModule = await import("./static");
|
||||
const staticModule = await import("./static.js");
|
||||
log = staticModule.log;
|
||||
serveStatic = staticModule.serveStatic;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import type { Express } from "express";
|
||||
import { createServer, type Server } from "http";
|
||||
import { storage } from "./storage";
|
||||
import { insertLabelSchema, insertTaskSchema } from "@shared/schema";
|
||||
import { storage } from "./storage.js";
|
||||
import { insertLabelSchema, insertTaskSchema } from "../shared/schema.js";
|
||||
|
||||
export async function registerRoutes(app: Express): Promise<Server> {
|
||||
// Health check endpoint
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { type User, type InsertUser, type Label, type InsertLabel, type Task, type InsertTask } from "@shared/schema";
|
||||
import { type User, type InsertUser, type Label, type InsertLabel, type Task, type InsertTask } from "../shared/schema.js";
|
||||
import { randomUUID } from "crypto";
|
||||
|
||||
// modify the interface with any CRUD methods
|
||||
|
||||
Reference in New Issue
Block a user