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

74
Views
Using ESM and Commonjs within one project in typescript

Is it possible to use ESM only and Commonjs only modules in one project?

I'm using typescript to compile and my problem is that certain packages support only ESM and certain only Commonjs, so when I'm trying to compile on changing the module output with the compiler I'm getting an error:

when using compiler option module: "ES2020"

SyntaxError: Cannot use import statement outside a module

and the other way around when using commonjs.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

In your package.json

you should have

{...
  "type": "module",
...}
about 4 years ago · Juan Pablo Isaza Report
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!