vike
Version:
The Framework *You* Control - Next.js & Nuxt alternative for unprecedented flexibility and dependability.
19 lines (18 loc) • 586 B
JavaScript
export { dev };
import { prepareViteApiCall } from './prepareViteApiCall.js';
import { createServer } from 'vite';
import { setGlobalContext_isProduction } from '../runtime/globalContext.js';
/**
* Programmatically trigger `$ vike dev`
*
* https://vike.dev/api#dev
*/
async function dev(options = {}) {
setGlobalContext_isProduction(false);
const { viteConfigFromUserEnhanced } = await prepareViteApiCall(options, 'dev');
const server = await createServer(viteConfigFromUserEnhanced);
return {
viteServer: server,
viteConfig: server.config,
};
}