ES Modules: All You Need To Know
4 min readSep 4, 2022
ESM and CommonJS are Javascript’s module systems. Let’s understand how they compare and when to choose which system.
ES Modules (or short: ESM) and CommonJS (or short: CJS) are the two module systems in Javascript that are actively being used. Module Systems allow us to share and reuse code easily. For example, we can write a module for image compression which can then be distributed via npmjs.com and used…