0.9.0 • Published 4 years ago

vite-proxy v0.9.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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.