wds-use-vite
v0.3.1
Published
Web Dev Server middleware that uses Vite to transform and serve requests.
Downloads
39
Readme
Vite Middleware for Web Dev Server
A middleware for Web Dev Server (WDS) and Web Test Runner (WTR) that allows requests to be transformed and served using Vite. Rather than starting Vite's dev server alongside WDS/WTR and proxying requests to it, this will install Vite as a middleware component inside the WDS/WTR request pipeline.
Installation
npm install --save-dev wds-use-vite
Configuration
This package exports two functions
addVite
– Creates a WDS/WTR plugin that is responsible for starting Vite in middleware mode when WDS/WTR starts.useVite
– Defines a WDS/WTR middleware function that inspects the current request and determines if it should allow the Vite middleware to process it or not.
You must configure both in order for the Vite middleware to work as intended. To do so, modify your WDS/WTR config as follows:
import { addVite, useVite } from 'wds-use-vite';
export default {
plugins: [addVite()],
middleware: [useVite()],
// ... rest of config here ...
};