fix: use ssrLoadModule to load Express server in Vite dev plugin
Some checks are pending
Build / build (push) Waiting to run
Deploy / deploy (push) Waiting to run
Lint & Type Check / lint (push) Waiting to run
Security Scan / semgrep (push) Waiting to run
Security Scan / dependency-check (push) Waiting to run
Test / test (18.x) (push) Waiting to run
Test / test (20.x) (push) Waiting to run
Some checks are pending
Build / build (push) Waiting to run
Deploy / deploy (push) Waiting to run
Lint & Type Check / lint (push) Waiting to run
Security Scan / semgrep (push) Waiting to run
Security Scan / dependency-check (push) Waiting to run
Test / test (18.x) (push) Waiting to run
Test / test (20.x) (push) Waiting to run
Dynamic import("./server") resolves relative to Vite's .vite-temp/
compilation dir, not the project root. ssrLoadModule resolves from
/app root and processes TypeScript correctly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a57cdb029a
commit
885ea76d12
1 changed files with 1 additions and 1 deletions
|
|
@ -42,7 +42,7 @@ function expressPlugin(): Plugin {
|
|||
async configureServer(server) {
|
||||
try {
|
||||
console.log("[Vite] Loading Express server...");
|
||||
const { createServer } = await import("./server");
|
||||
const { createServer } = await server.ssrLoadModule("/server/index.ts");
|
||||
const app = createServer();
|
||||
console.log("[Vite] Express server created, mounting...");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue