# vue-dynamic-proxy

> vue-dynamic-proxy,The vue dynamic proxy does not need to be restarted

Latest version **1.0.7** (published 2023-04-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install vue-dynamic-proxy
pnpm add vue-dynamic-proxy
yarn add vue-dynamic-proxy
bun add vue-dynamic-proxy
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2023-04-24 |
| First published | 2023-04-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | yutai |
| Keywords | vue, dynamic, proxy, vue-dynamic-proxy |

## Links

- npm: https://www.npmjs.com/package/vue-dynamic-proxy
- npm.io page: https://npm.io/package/vue-dynamic-proxy

## Recent versions

- 1.0.7 (latest) — 2023-04-24
- 1.0.6 — 2023-04-20
- 1.0.5 — 2023-04-20
- 1.0.3 — 2023-04-20
- 1.0.2 — 2023-04-19
- 1.0.1 — 2023-04-19
- 1.0.0 — 2023-04-19

## README

## 安装
```
npm install -D vue-dynamic-proxy
```

## webpack4使用
```
vue.config.js 引入

const { after } = require('vue-dynamic-proxy')

function resolve(dir) {
  return path.join(__dirname, dir)
}
// 配置
devServer: {
    // 必须是绝对路径
    after: after(resolve('proxy.config.js'))
},
```

## webpack5使用
```
vue.config.js 引入

const { setupMiddlewares } = require('vue-dynamic-proxy')

function resolve(dir) {
  return path.join(__dirname, dir)
}
// 配置
devServer: {
    // 必须是绝对路径
    setupMiddlewares: setupMiddlewares(resolve('proxy.config.js'))
},
```

### proxy.config.js
```
module.exports = [
  {
    prefix: '/dev-api',
    target: 'http://localhost:8081',
    changeOrigin: true,
    pathRewrite: {
      '^/dev-api': '/prod-api'
    }
  },
  {
    prefix: '/api',
    target: 'http://localhost:8989',
    changeOrigin: true,
    pathRewrite: {
      '^/api': '/prod-api'
    }
  },
]
```

---
_Source: https://npm.io/package/vue-dynamic-proxy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
