Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

274
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda