It seems that using tsc with compilerOptions.module
set to None
or CommonJS
is producing the same transpiled code. How do these two differ? Why are there two options for producing (apparently) the same transpiled code?
With module
set to None
, we cannot use imports, exports, or module augmentations (except for the way that @artem notes in the below comments.)
Here is the source of the message.
"Cannot use imports, exports, or module augmentations when '--module' is 'none'.": {
"category": "Error",
"code": 1148
},
With module
set to CommonJS
, if we choose not to use imports, exports, or module augmentations, then our output might look the same as it does when we set module
to None
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With