I find many tsconfig.json samples always have compilerOptions
like this
"module": "commonjs",
"moduleResolution": "node"
I feel setting them both as such seems unnecessary because if moduleResolution
is node
the module
is definitely commonjs
. The module
is commonjs
, moduleResolution
is definitely node
too (I can't think of any other case)
Isn't that is the case?
--- update ---
Now I realize it is not always the case because nodejs has fully support ES Modules, so I can use "module": "ES2020" & "moduleResolution": "node"
(for nodejs 14+) but of course if I set "module":"commonjs"
I don't need to set "moduleResolution": "node"
Further refer to What TypeScript configuration produces output closest to Node.js 14 capabilities?