@vavite-giacomorebonato/expose-vite-dev-server
v0.0.4
Published
Vite plugin for exposing Vite's development server to user code
Downloads
5
Readme
This is a fork of:
- https://github.com/cyco130/vavite
- https://www.npmjs.com/package/vavite
@vavite-giacomorebonato/expose-vite-dev-server
@vavite-giacomorebonato/expose-vite-dev-server
is a Vite plugin for exposing the Vite development server to user code during development. It can be used for accessing Vite development server methods such as ssrFixStacktrace
and transformIndexHtml
in vavite
, @vavite-giacomorebonato/connect
, and @vavite-giacomorebonato/reloader
applications.
Installation and usage
Install vite
and @vavite-giacomorebonato/expose-vite-dev-server
as development dependencies (npm install --save-dev vite @vavite-giacomorebonato/expose-vite-dev-server
) and add @vavite-giacomorebonato/expose-vite-dev-server
plugin to your Vite config:
import { defineConfig } from "vite";
import exposeViteDevServer from "@vavite-giacomorebonato/expose-vite-dev-server";
export default defineConfig({
plugins: [exposeViteDevServer()],
});
Now you can import the dev server in your application with import viteDevServer from @vavite-giacomorebonato/expose-vite-dev-server/vite-dev-server
during development. In production, it will be available but its value will be undefined
.