vite-proxy
v0.9.0
Published
A plugin for [Vite](https://github.com/vuejs/vite) that proxies requests to other services
Downloads
2
Readme
vite-proxy
A plugin for Vite that proxies requests to other services
install
yarn add --dev vite-proxy
use
See demo/main.js
for a full example.
const { createServer } = require('vite')
const proxy = require('vite-proxy')
createServer({
plugins: [
proxy({
'/local/path': 'http://remote.server/path'
})
]
})
api
example: proxy: { '/v3/*': 'https://polyfill.io/' }
example: proxy: { '/v3/*': ['https://polyfill.io/', { https: true }] }
The default export takes an object where the key is the route to attach to locally, and the value is the destination to proxy to.
The destination can be either a string, or an array specifying the two arguments for koa-better-http-proxy.