项目作者: deraw

项目描述 :
🔌 Provide all http-proxy-middleware options to vue-cli
高级语言: JavaScript
项目地址: git://github.com/deraw/vue-cli-plugin-proxy.git
创建时间: 2018-10-02T00:05:50Z
项目社区:https://github.com/deraw/vue-cli-plugin-proxy

开源协议:MIT License

下载




Vue CLI proxy plugin

This plugin is meant to provide all http-proxy-middleware options to vue-cli.


NPM Version
NPM Downloads
License
The issue

Issue

See the issue than initiated this plugin (#2320)

Installation

  1. yarn add @deraw/vue-cli-plugin-proxy
  2. # OR npm install @deraw/vue-cli-plugin-proxy

Usage

  1. // vue.config.js
  2. module.exports = {
  3. pluginOptions: {
  4. proxy: {
  5. enabled: true,
  6. context: '',
  7. options: {
  8. // ...
  9. }
  10. }
  11. }
  12. }

Options

See http-proxy-middleware for options object to pass to the plugin.

Object examples

  • First example of the docs:
  1. // vue.config.js
  2. module.exports = {
  3. pluginOptions: {
  4. proxy: {
  5. enabled: true,
  6. context: '/api',
  7. options: {
  8. target: 'http://www.example.org',
  9. changeOrigin: true
  10. }
  11. }
  12. }
  13. }
  • v1.0.0 default:
  1. // vue.config.js
  2. module.exports = {
  3. pluginOptions: {
  4. proxy: {
  5. enabled: true,
  6. context: [
  7. '/**',
  8. '!/dist/**'
  9. ],
  10. options: {
  11. target: 'http://127.0.0.1:8000'
  12. }
  13. }
  14. }
  15. }

License

Vue CLI Plugin Proxy is licensed under MIT License.