❌ Wrong setup
Vite should only be loaded in development (or when building). Loading it in production is unnecessary and significantly bloats the production process.
In production:
-
Make sure you don't load the
vitepackage nor Vike's Vite plugin. -
Make sure you don't call
createDevMiddleware(). (The development middleware isn't needed in production.)You can import
createDevMiddlewarein production, but make sure you don't call it.// Environment: production import { createDevMiddleware } from 'vike/server' // ✅ You can import it createDevMiddleware() // ❌ You shouldn't call itIf you use
+server.jsor+serverEntry.js, the development middleware is automatically created — you don't need to usecreateDevMiddleware()at all. (You only needcreateDevMiddleware()if you run the server yourself.)