Vite plugin with a local emulation of the Netlify environment
npm install @netlify/vite-pluginVite plugin that emulates Netlify's platform features within your Vite dev server.
| Feature | Supported |
| ---------------------- | --------- |
| Functions | ✅ Yes |
| Edge Functions | ✅ Yes |
| Blobs | ✅ Yes |
| Cache API | ✅ Yes |
| Redirects and Rewrites | ✅ Yes |
| Headers | ✅ Yes |
| Environment Variables | ✅ Yes |
| Image CDN | ✅ Yes |
> This module is not intended to be a full replacement for the Netlify CLI.
``bash`
npm install @netlify/vite-plugin
The plugin accepts the following options:
- middleware (boolean, default: true): Attach a Vite middleware that intercepts requests and handles them in theblobs
same way as the Netlify production environment
- : Configure blob storage functionalityedgeFunctions
- : Configure edge functionsfunctions
- : Configure serverless functionsheaders
- : Configure response headersimages
- : Configure Image CDN functionalityredirects
- : Configure URL redirectsstaticFiles
- : Configure static file serving
Add the plugin to your vite.config.js or vite.config.ts:
`js
import { defineConfig } from 'vite'
import netlify from '@netlify/vite-plugin'
export default defineConfig({
plugins: [netlify()],
})
``