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

holtwick/zerva-vite-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌱 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.