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

104
Views
ES6 and values previously provided by the require object

In ES6 and later we prefer import over require.

In the absence of the require object, how does one access values historically presented as attributes of the require object? For example, require.main.filename

If there is a topic in the Node documentation dealing with this a reference would be greatly appreciated. In the meantime, I persist while Google fails to be my friend... obviously I'm asking the wrong question. Better search terms would also be helpful.

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

0

Accessing properties on the require function has been replaced by accessing the import.meta object in ES modules. It allows implementations to expose metadata about the module in a standard location.

Node.js in particular currently supports import.meta.url (like CommonJS __filename and __dirname) and import.meta.resolve (like require.resolve). The discussion about adding import.meta.main appears to have stalled.

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!