Skip to content
This repository was archived by the owner on Sep 29, 2022. It is now read-only.

Latest commit

History

History
36 lines (25 loc) 路 1.04 KB

File metadata and controls

36 lines (25 loc) 路 1.04 KB

馃尡 Zerva Vite

DEPRECATED. Please use zerva-vite instead. Thanks.


This is a side project of Zerva

Integrate Zerva modules into vite.config.ts using this Vite Plugin.

This is perfect to use and test your server side code while developing the frontend without handling parallel launching and running server processes.

The plugin already calls useHttp with the same port as the vite process. In fact it is the same server instance Vite uses. Custom routes can be added or sockets get bound to it.

Get started

import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
import { useSocketIO } from "zerva-socketio"
import { viteZervaPlugin } from "./src/module"

export default defineConfig({
  plugins: [
    vue(),

    // Make use of Zerva from inside Vite server
    viteZervaPlugin(async () => {
      // Zerva modules
      useSocketIO()
    }),
  ],
})

See demo for a more complex example.