Slide 24
Slide 24 text
Should we use Native ESM (for Library)?
- Recommendation: Yes, use Native ESM
- To achieve broadest interoperability, yes.
- Maybe Sloppy ESM would be OK in development, but the results are harder to predict.
- Should we also provide CJS version?: Yes, but relaxed by require(esm)
- For “Fake ESM” codebases, truly yes
- Watch an adaption rate of Node.js, require(esm) supported version
CJS Fake ESM Sloppy ESM Native ESM
Actually runs as CJS CJS ESM ESM
import or require require import import import
Extension guessing ✅ ✅ ✅ ❌
Folders as Modules ✅ ✅ ✅ ⚠