node.js – Is there any performance difference in ES modules vs Common JS modules in NodeJS servers?
An import statement can reference an ES module or a CommonJS module. import statements are permitted only in ES modules, but dynamic import() expressions are supported in CommonJS for loading ES modules.
When importing CommonJS modules, the module.exports object is provided as the default export. Named exports may be available, provided by static analysis as a convenience for better ecosystem compatibility.
The major difference in commonjs and ES module is of synchronous and asynchronous nature>>
-commonjs modules are synchronous, this is’nt an issue in case of small module execution but in case of large modules it can be delay to process. while,
-loading and parsing of ES modules is asynchronous, this is the difference where may be the performance gets vary..
Read more here: Source link