It seems that proxyTable is now deprecated according to this:
https://github.com/chimurai/http-proxy-middleware#http-proxy-middleware-options
Thanks for the pointer.
There ar enot code changes necessary, but we should update the example in the docs accordingly:
https://github.com/vuejs-templates/webpack/blob/develop/docs/proxy.md
I would like to update the docs for this change, but reading through the docs i cannot figure out what should be updated.
@LinusBorg any pointers?
Why was this closed? This issue has not been resolved.
What exactly is the remaining problem? We switched to webpack-dev-server, so we don't use the middleware directly anymore. We use the dev-server's correct api for this, so I see no problem remaining to fix.
However, so if there still is something missing or wrong with our docs or the config, please let us know and I can reopen this.
@LinusBorg maybe I'm not understanding correctly, but I just pulled down a new copy of Vue-cli@latest with Webpack, and build/webpack.dev.conf is still pulling proxy data from config.dev.proxyTable, which is located in config/index.js, which still has a proxyTable property present. Additionally the docs (here) still suggest using proxyTable?
Well, that's just the internal name in the template. We pass the data specified there to the proxy option of webpack-dev-server which then handles it internally for us.
So technically it doesn't matter what we call this field in the /config file. I'm open to rename this to proxy so it's using the same name as the webpack-dev-serveroption, but that's cosmetics.
I'm still getting to grips with webpack and vue so apologies if this is a dumb question, but how exactly do a specify the proxy, for a production build?
I thought this would be enough:
NODE_ENV=production HOST=https://api.production.com PORT=443 npm run build
But that didn't seem to work. Am I supposed to ignore the provided build command and write my own that directly works with webpack?
You dont. That's the while point - you use the production api in you code, and webpack-dev-server proxies those requests to your test backend during development.
In production, there should be no need for a proxy.
If you want to switch api urls in development and production, you should rather read the template's docs about environment variables.
Most helpful comment
Well, that's just the internal name in the template. We pass the data specified there to the
proxyoption ofwebpack-dev-serverwhich then handles it internally for us.So technically it doesn't matter what we call this field in the
/configfile. I'm open to rename this toproxyso it's using the same name as thewebpack-dev-serveroption, but that's cosmetics.