Which statement about ES modules in Node.js is correct?
- A require() can load an ES module synchronously
- B An ES module can import a CommonJS module, but CommonJS cannot require an ES module
- C ES modules are enabled by default in every Node version
- D ES modules provide __dirname automatically
Answer
An ES module can import a CommonJS module, but CommonJS cannot require an ES module
require is synchronous while ESM resolution is asynchronous, which creates the asymmetry. Under ESM, use import.meta.url instead of __dirname.





