Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin API can not change the proxy, why? #2053

Closed
Fl0pZz opened this issue Aug 3, 2018 · 6 comments
Closed

Plugin API can not change the proxy, why? #2053

Fl0pZz opened this issue Aug 3, 2018 · 6 comments

Comments

@Fl0pZz
Copy link

Fl0pZz commented Aug 3, 2018

Version

3.0.0-rc.10

Node and OS info

node 10.7

Steps to reproduce

Plugin API can not change the proxy, why?

const projectDevServerOptions = options.devServer || {}
use only proxy settings from vue.config.js

What is expected?

I expect that I can change the proxy settings, through Plugin API and webpack config (chaining or configure)

What is actually happening?

Nothing

@Fl0pZz
Copy link
Author

Fl0pZz commented Aug 3, 2018

vue inspect | grep devServer has an empty output (but i add devServer config into vue.config.js)

@haoqunjiang
Copy link
Member

@Fl0pZz How did you add devServer config? Can't reproduce this issue with the following config.

module.exports = {
  chainWebpack: config => {
    config
      .devServer
      .proxy({
        '/api': 'http://localhost:3000'
      })
  }
}

@haoqunjiang haoqunjiang added the needs reproduction This issue is missing a minimal runnable reproduction, provided by the author label Aug 3, 2018
@Fl0pZz
Copy link
Author

Fl0pZz commented Aug 3, 2018

https://cli.vuejs.org/config/#devserver-proxy

// vue.config.js
module.exports = {
  devServer: {
    proxy: {
      '/api': {
        target: '<url>',
        ws: true,
        changeOrigin: true
      },
      '/foo': {
        target: '<other_url>'
      }
    }
  }
}

@Fl0pZz
Copy link
Author

Fl0pZz commented Aug 3, 2018

@sodatea and your code don't work, because https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/util/prepareProxy.js#L116

@Fl0pZz
Copy link
Author

Fl0pZz commented Aug 3, 2018

Oh, sorry.
vue inspect | grep devServer has an empty output (but I add devServer config into vue.config.js) - my mistake. That's ok

@Fl0pZz
Copy link
Author

Fl0pZz commented Aug 3, 2018

However, the original question remains open:
Plugin API cannot change the proxy, why?

@haoqunjiang haoqunjiang removed the needs reproduction This issue is missing a minimal runnable reproduction, provided by the author label Aug 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants