Open Profesor08 opened 1 year ago
There are the docs https://vitejs.dev/guide/api-plugin.html#configurepreviewserver
import { Connect, Plugin, PreviewServerForHook, ViteDevServer } from "vite";
export const ViteMockServer = (options?: MockOptions): Plugin => {
return {
name: PLUGIN_NAME,
configureServer: createConfiguratedServer(options),
configurePreviewServer: createConfiguratedServer(options),
};
};
const createConfiguratedServer = (options: MockOptions = {}) => {
return async (server: ViteDevServer | PreviewServerForHook) => {
// code
};
};
If you start build preview
vite preview
ofnpm run preview
, it not working, any api request returns index page.