DEV Community

Discussion on: Developing and deploying create-react-app to multiple Firebase environments

Collapse
 
rodiwa profile image
RD

I was running into issues when setting up proxy (in src/setupProxy.js). I went through the changelog for http-proxy-middleware and found that require/import of http-proxy-middleware is now explicit.

So please try const { createProxyMiddleware } = require('http-proxy-middleware'); instead of const proxy = require('http-proxy-middleware'); to fix this.

You basically need to do this now

const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
  app.use(
    '/__',
    createProxyMiddleware({
      target: 'http://localhost:4000'
    })
  );
};
Enter fullscreen mode Exit fullscreen mode

Hope this helps :)