Node.js · Junior · Question 16 of 75

Which variables are not available in an ES module but exist in CommonJS?

Explanation

CommonJS wraps each file in a function that receives __dirname and __filename. In ESM the same information is on import.meta, including import.meta.url.

Further reading

Problem with a question

Node.js · Junior · question 16

Test yourself

Take the Node.js · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz