Why use ECMAScript modules (import) instead of CommonJS (require)? The most obvious difference between ESM and CommonJS is the use of import and export vs the use of require and module.exports. But that is not all… In regards to performance, with ESM import you can selectively load only the pieces you need. This can save you runtime memory or package size. CommonJS (require) loads the modules sync

