Skip to content

Commit 826f291

Browse files
committed
fix: use dynamic import for vite in development only
Static import of vite fails in production because vite is a devDependency that gets pruned. Changed to dynamic import inside the isProduction check so the import only happens in development.
1 parent 90c6c2e commit 826f291

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

server/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import express from 'express';
2-
import { createServer } from 'vite';
32
import fs from 'fs';
43
import proxy from './proxy.js';
54

@@ -12,6 +11,7 @@ async function startServer() {
1211
// Setup Vite middleware (development only)
1312
let vite;
1413
if (!isProduction) {
14+
const { createServer } = await import('vite');
1515
vite = await createServer({
1616
server: { middlewareMode: true },
1717
appType: 'custom',

0 commit comments

Comments
 (0)