Vue-cli: devServer.proxy support array config

Created on 20 Aug 2018  路  1Comment  路  Source: vuejs/vue-cli

What problem does this feature solve?

Passing an Array to devServer.proxy is not supported.
It can be used to proxy multiple, specific paths to the same target.

https://webpack.js.org/configuration/dev-server/#devserver-proxy

What does the proposed API look like?

module.exports = {
  //...
  devServer: {
    proxy: [{
      context: ['/auth', '/api'],
      target: 'http://localhost:3000',
    }]
  }
};
feature request

Most helpful comment

You can get equivalent functionality via:

{
  proxy: {
    ...['/auth', '/api'].reduce(
      (acc, ctx) => ({
        ...acc,
        [ctx]: { target: 'http://localhost:3000' },
      }),
      {}
    ),
  },
},

>All comments

You can get equivalent functionality via:

{
  proxy: {
    ...['/auth', '/api'].reduce(
      (acc, ctx) => ({
        ...acc,
        [ctx]: { target: 'http://localhost:3000' },
      }),
      {}
    ),
  },
},
Was this page helpful?
0 / 5 - 0 ratings

Related issues

miyamoto-san picture miyamoto-san  路  3Comments

BusyHe picture BusyHe  路  3Comments

csakis picture csakis  路  3Comments

joshuajohnson814 picture joshuajohnson814  路  3Comments

PrimozRome picture PrimozRome  路  3Comments