Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

354
Vistas
React App - createProxyMiddleware is not a function

I am working on a react project and am running into some issues with http-proxy-middleware. I followed the readme and my setupProxy.js file looks like this

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


module.exports = function(app) {
  app.use(
    '/api',
    createProxyMiddleware({
      target: 'https://localhost:3000',
      changeOrigin: true
    })
  );
};

Anyone have any ideas as to why this might be occurring? From what I've seen, this is the correct way to set this up. Any response or suggestions will be greatly appreciated.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

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');
over 4 years ago · Santiago Trujillo Denunciar

0

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/

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda