I fail to understand why there is both a "module"
& "moduleResolution"
setting.
I have always thought of a module, as being nothing more than a specification (and/or standard) that defines the way that software-packages "resolve", and are "resolved-by", other software packages that adhere to the same specification (and/or standard).
Maybe that is an accurate perception, maybe not, either way, I don't see any reason for configuring the module
type, and the moduleResolution
separately. I am not criticizing TypeScript here, I know with 100% certainty, that I am the one lacking, not TypeScript. I am just trying to get a fundamental understanding for how to configure my TypeScript projects.
What is the difference between "module" & "moduleResolution"?
How does the
tsconfig.json
settingmodule
affect the modules (or packages) being imported by a project? And what impact does it have on the JavaScript that is transpilled and emitted by the TypeScript compilertsc
?How does the
tsconfig.json
settingmoduleResolution
affect the modules (or packages) being imported by a project? And what impact does it have on the JavaScript that is transpilled and emitted by the TypeScript compilertsc
?
moduleResolution
determines the algorithm used for finding/resolving modules e.g. looking innode_modules
or searching relative pathsmodule
determines the type of import/export used -For
module
node12/nodenext
The docs are a bit behind for
node16
but they're being updated