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

327
Vistas
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 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