@deraw/vue-cli-plugin-proxy

Provide all http-proxy-middleware options to vue-cli

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@deraw/vue-cli-plugin-proxy
1132.2.72 years ago3 years agoMinified + gzip package size for @deraw/vue-cli-plugin-proxy in KB

Readme

width="280" src="https://user-images.githubusercontent.com/10298932/59419196-af91f800-8dca-11e9-9ea8-de5567e9e471.png" alt="" >


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

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

Usage

// vue.config.js
module.exports = {
    pluginOptions: {
        proxy: {
            enabled: true,
            context: '',
            options: {
                // ...
            }
        }
    }
}

Options

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

Object examples

  • First example of the docs:

// vue.config.js
module.exports = {
    pluginOptions: {
        proxy: {
            enabled: true,
            context: '/api',
            options: {
                target: 'http://www.example.org',
                changeOrigin: true
            }
        }
    }
}

  • v1.0.0 default:

// vue.config.js
module.exports = {
    pluginOptions: {
        proxy: {
            enabled: true,
            context: [
              '/**',
              '!/dist/**'
            ],
            options: {
                target: 'http://127.0.0.1:8000'
            }
        }
    }
}

License

Vue CLI Plugin Proxy is licensed under MIT License.