> CommonJS - legacy output (for KJS)
I don't consider it a "legacy" output, as CommonJS is probably the most commonly used module system at this point.
The difference is ESM exports aims to target the per-file export, effectively eliminating the need for ad-hoc namespacing. You basically replace them with a folder structure to represent the Kotlin package structure.