wds-use-vite
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

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 ...
};

Readme

Keywords

Package Sidebar

Install

npm i wds-use-vite

Weekly Downloads

1

Version

0.3.1

License

MIT

Unpacked Size

9.05 kB

Total Files

6

Last publish

Collaborators

  • mvromer