Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

325
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!