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

331
Visualizações
Express/NodeJS issue: ReferenceError: exports is not defined

I'm built and REST API and now I'm trying to consuming it. I'm using fetch as the same way that it's used in JS. Example: JS: fetch example

I'm working with express and typescript, this is my tsconfig if it can help: tsconfig

I'm trying to do the same call that is in JS in my server.ts: server.ts

But I'm having this error:

ReferenceError: exports is not defined.

I've trying to resolve the problem, I've checked lot of websites but I didn't find a good solution.

I find once that is to put "type":"module" in the package.json after install node-fetch module because it need it to be imported well. But should be something else that I'm missing right now related to configuration (commonjs, babel or something...)

Thank you.

This is the error that I'm getting if I use fetch (no "type":"module" in package.json). Is different to the previouse one where I have the "type":"module" in the package.json

no "type": "module in package.json, error:

about 4 years ago · Juan Pablo Isaza
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