Skip to content

Commit

Permalink
Defer to @tsconfig settings for module
Browse files Browse the repository at this point in the history
The "module" setting is defined in the base tsconfig.json that we're
using, and overriding it actually resulted in a mismatch with the
latest `moduleResolution` that was being defined in that base.

The `Node16` setting appears to simply signal *support* for ESM
depending on the `type` setting in `package.json`.  This is based on the
ECMAScript Modules in Node.js documentation[1] as well as the TS
configuration documentation[2].

I've added `"type": "commonjs"` to `package.json` although the omitted
setting defaulted to `commonjs` which means this change is just to make
the setting explicit.

[1] https://www.typescriptlang.org/docs/handbook/esm-node.html
[2] https://www.typescriptlang.org/tsconfig#node16nodenext-nightly-builds
  • Loading branch information
slifty committed Aug 31, 2023
1 parent e567137 commit b1fd1bf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"engines": {
"node": "18"
},
"type": "commonjs",
"devDependencies": {
"@tsconfig/node18": "^18.2.1",
"@types/cors": "^2.8.13",
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "@tsconfig/node18/tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "dist",
"declaration": true,
"esModuleInterop": true,
Expand Down

0 comments on commit b1fd1bf

Please sign in to comment.