You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Matěj Chalk edited this page Aug 18, 2023
·
12 revisions
Motivation
We've decided on using JavaScript config files. But this presents the problem whether to support both CommonJS and ES Modules, and how that can be implemented and tested.
Comparison
CommonJS
ES Modules
ecosystem trends
older and more widely supported
Node 13+ and some newer packages
import/export syntax
require() and module.exports =
import and export, also dynamic import()
explicit file extensions
.cjs/.cts
.mjs/.mts
implicit file extensions (.js)
if "type" not specified or set to "commonjs" in package.json