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

proxyMiddleware Configuration is invalid #163

Closed
viest opened this issue Sep 7, 2016 · 1 comment
Closed

proxyMiddleware Configuration is invalid #163

viest opened this issue Sep 7, 2016 · 1 comment

Comments

@viest
Copy link

viest commented Sep 7, 2016

The app. Use (proxyMiddleware) put to the front, NPM run dev output

[HPM] Proxy created: /vikin  ->  http://www.example.org

Request [ localhost:8080/vikin ] did not use [ http://www.example.org ]

var path = require('path')
var express = require('express')
var webpack = require('webpack')
var config = require('../config')
var proxyMiddleware = require('http-proxy-middleware')
var webpackConfig = process.env.NODE_ENV === 'testing'
  ? require('./webpack.prod.conf')
  : require('./webpack.dev.conf')

var port = process.env.PORT || config.dev.port
var proxyTable = config.dev.proxyTable

var app = express()
var compiler = webpack(webpackConfig)

Object.keys(proxyTable).forEach(function (context) {
  var options = proxyTable[context]
  if (typeof options === 'string') {
    options = { target: options }
  }
  app.use(proxyMiddleware(context, options))
})
@viest viest changed the title proxyMiddleware配置无效! proxyMiddleware Configuration is invalid Sep 7, 2016
@zigomir
Copy link
Contributor

zigomir commented Sep 7, 2016

@VikinArtisan Please report this to webpack template's repository. It has nothing to do with vue-cli. Also share your proxyTable config so they can help you more easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants