0.0.8 • Published 3 years ago

vite-plugin-show-proxy v0.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

vite-plugin-show-proxy

NPM version

Usage

vite.config.ts

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ShowProxy from 'vite-plugin-show-proxy'

export default defineConfig({
  plugins: [
    vue(),
    ShowProxy(),
  ],
  server: {
    proxy: {
      '/foo': 'http://localhost:4567',
      '/api': {
        target: 'http://jsonplaceholder.typicode.com',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/api/, ''),
      },
      '^/fallback/.*': {
        target: 'http://jsonplaceholder.typicode.com',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/fallback/, ''),
      },
      '/socket.io': {
        target: 'ws://localhost:3000',
        ws: true,
      },
    },
  },
})
npm run dev
 vite v2.9.12 dev server running at:

  > Local: http://localhost:3000/
  > Network: use `--host` to expose

  ready in 430ms.

  >Show Proxy:
    '/foo' => http://localhost:4567
    '/api' => http://jsonplaceholder.typicode.com
    '^/fallback/.*' => http://jsonplaceholder.typicode.com
    '/socket.io' => ws://localhost:3000

License

MIT License © 2022 yuyinws

0.0.8

3 years ago

0.0.7

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago