Fix Vercel build by avoiding Supabase init during Vite config load and harden server Supabase init
cgen-ff07f5499dbd4adf8a80568e8899d8c2
This commit is contained in:
parent
3d3b12aa7f
commit
c3ac16c346
1 changed files with 7 additions and 5 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import { defineConfig, Plugin } from "vite";
|
||||
import react from "@vitejs/plugin-react-swc";
|
||||
import path from "path";
|
||||
import { createServer } from "./server";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(({ mode }) => ({
|
||||
|
|
@ -30,10 +29,13 @@ function expressPlugin(): Plugin {
|
|||
name: "express-plugin",
|
||||
apply: "serve", // Only apply during development (serve mode)
|
||||
configureServer(server) {
|
||||
const app = createServer();
|
||||
|
||||
// Add Express app as middleware to Vite dev server
|
||||
server.middlewares.use(app);
|
||||
(async () => {
|
||||
const { createServer } = await import("./server");
|
||||
const app = createServer();
|
||||
server.middlewares.use(app);
|
||||
})().catch((e) => {
|
||||
console.error("Failed to start express middleware:", e);
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue