{"id":26580,"library":"vavite","title":"vavite","description":"vavite is a Vite plugin for developing and building server-side applications, using Vite as the transpiler/bundler. It enables using Vite's SSR capabilities for general server-side code (TypeScript, JSX) without extra tools like ts-node. Current stable version is 6.2.1, supporting Vite 7 or 8 (peer dependency). Key differentiators: simplifies SSR workflow, supports handler and server entry types, provides HMR for server code. Rewritten in v6 with a simplified API, server-side HMR, and separate server mode (e.g. for Bun.serve).","status":"active","version":"6.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/cyco130/vavite","tags":["javascript","nextjs","react","ssr","vite"],"install":[{"cmd":"npm install vavite","lang":"bash","label":"npm"},{"cmd":"yarn add vavite","lang":"bash","label":"yarn"},{"cmd":"pnpm add vavite","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; vavite is a Vite plugin and requires Vite to be installed.","package":"vite","optional":false}],"imports":[{"note":"v3.0.0 changed from default export to named export. Using default import will result in a runtime error.","wrong":"import vavite from 'vavite'","symbol":"vavite","correct":"import { vavite } from 'vavite'"},{"note":"VavitePluginOptions is a TypeScript type, not a value; it should be imported with the `type` keyword (or use `import type`).","wrong":"import { VavitePluginOptions } from 'vavite'","symbol":"VavitePluginOptions","correct":"import type { VavitePluginOptions } from 'vavite'"},{"note":"defineConfig is from Vite, not from vavite. A common mistake is confusing the source.","wrong":"import { defineConfig } from 'vavite'","symbol":"defineConfig","correct":"import { defineConfig } from 'vite'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport { vavite } from 'vavite';\n\nexport default defineConfig({\n  appType: 'custom',\n  plugins: [\n    vavite({\n      // Optional: entries, type, etc.\n    }),\n  ],\n});\n\n// src/entry.server.ts\n/// <reference types=\"vite/client\" />\n/// <reference types=\"vavite/types\" />\n\nimport { createServer, type IncomingMessage, type ServerResponse } from 'node:http';\n\nexport default function handler(req: IncomingMessage, res: ServerResponse) {\n  if (req.url === '/') {\n    res.setHeader('Content-Type', 'text/html; charset=utf-8').end('<h1>Hello from vavite!</h1>');\n  } else {\n    res.statusCode = 404;\n    res.end('Not found');\n  }\n}\n\nif (import.meta.env.COMMAND === 'build') {\n  createServer(handler).listen(3000, () => console.log('Server on http://localhost:3000'));\n}\n\nif (import.meta.hot) {\n  import.meta.hot.accept();\n}","lang":"typescript","description":"Minimal project setup: Vite config with vavite plugin, and a handler entry that responds to root requests with HTML and starts a standalone production server."},"warnings":[{"fix":"Change to named import: import { vavite } from 'vavite'.","message":"v3.0.0 changed from default export to named export: import vavite from 'vavite' becomes import { vavite } from 'vavite'.","severity":"breaking","affected_versions":">=3.0.0 <4.0.0"},{"fix":"Consult the migration notes at https://github.com/cyco130/vavite#migrating-from-v5.","message":"v6.0.0 is a complete rewrite with a simplified API. Old plugin options and entry types are deprecated.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Use `type: 'handler'` in entries configuration.","message":"The `runnable-handler` and `runnable-server` entry types are replaced by a single `handler` entry in v6.","severity":"deprecated","affected_versions":">=6.0.0"},{"fix":"Wrap production server start with `if (import.meta.env.COMMAND === 'build')`.","message":"In handler entries, the default export is used for dev mode, but for production you must explicitly start the server. The `import.meta.env.COMMAND` check is required to avoid starting the server in dev mode.","severity":"gotcha","affected_versions":">=6.0.0"},{"fix":"Add the triple-slash directives at the top of your entry file, or include them in tsconfig.json types array.","message":"TypeScript builds may fail if triple-slash references are missing: `/// <reference types=\"vite/client\" />` and `/// <reference types=\"vavite/types\" />`.","severity":"gotcha","affected_versions":">=6.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install vavite as dev dependency: npm install --save-dev vavite. Ensure tsconfig.json includes 'node' in types or 'moduleResolution' is 'bundler'.","cause":"Missing installation or misconfigured tsconfig paths.","error":"Cannot find module 'vavite' or its corresponding type declarations."},{"fix":"Change `import vavite from 'vavite'` to `import { vavite } from 'vavite'`.","cause":"Using default import after v3.0.0 which switched to named exports.","error":"The requested module 'vavite' does not provide an export named 'default'"},{"fix":"Ensure src/entry.server.{js,ts} exists with a default export and correct entry type in config.","cause":"Missing or misconfigured entry file. vavite expects a default export handler or server entry.","error":"[vite] Internal server error: Cannot read properties of undefined (reading 'on')"},{"fix":"Ensure your project is ESM (type: module in package.json) and Node.js >=18.","cause":"Node.js version mismatch or ESM/CJS conflict. vavite requires Node.js ESM support.","error":"ERR_UNSUPPORTED_DIR_IMPORT from node_modules/vavite"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}