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

116
Views
Dynamic import does not find file when .js extension

I have this small TS app.

Where i have an file called en.js which looks like:

export default {
   name: "test"
}

When i try to import it, it does not work:

await import("./en.js")

It says code: 'MODULE_NOT_FOUND'

But if i rewrite it to an .json it works:

//en.json
{
   "name": "test"
}

Then the import works just fine:

await import("./en.json");
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It needs to be declared as a const in order to be exported as a module. Please try the following

export default const Test = {
   name: "test"
}
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!