reactjs – React App – createProxyMiddleware is not a function

reactjs – React App – createProxyMiddleware is not a function

Removing the brackets works for me

const createProxyMiddleware = require(http-proxy-middleware);

Found that fix here https://www.reddit.com/r/reactjs/comments/jzoo3y/createproxymiddleware_is_not_a_function_how_can_i/

If all React js component files are in the component folder(or in another folder) then shift your Setupproxy.js file in that folder now you can use

 const { createProxyMiddleware } = require(http-proxy-middleware);

For global, put your Setupproxy.js file in src folder then you have to remove {}

const createProxyMiddleware = require(http-proxy-middleware);

reactjs – React App – createProxyMiddleware is not a function

Leave a Reply

Your email address will not be published.