This is an experiment to see what can be achieved with plugins to adapt the behavior of vite dev server for additional needs Some experiments might not ever be useful to you, others might land in vite. The existence of this plugin does not mean vite is pushing users security out into a user concern, quite the opposite.
A plugin to enhance security of the dev server in Vite.
npm install --save-dev @svitejs/vite-plugin-protect
// vite.config.js
import { defineConfig } from 'vite';
import { protect } from '@svitejs/vite-plugin-protect';
export default defineConfig({
plugins: [
protect({
/* plugin options */
})
]
});
Package | Changelog |
---|---|
@svitejs/vite-plugin-protect | Changelog |
Join the Vite Discord server!
- Run
pnpm i
to install dependencies - Run
pnpm dev
inpackages/playground
to start a Vite app
Note that changes in the plugin needs restart of the Vite dev server.