From 605de78d2cd7303bf25d9e2146e2b707dbf63d4f Mon Sep 17 00:00:00 2001 From: Tyler Butler Date: Mon, 6 Nov 2023 14:34:58 -0800 Subject: [PATCH] fix: improve compatibility with node16 module resolution (#1595) Related: - https://github.com/microsoft/TypeScript/issues/46770#issuecomment-966612103 - https://github.com/socketio/socket.io-client/issues/1589 --- package.json | 17 +++++++++++++---- tsconfig.json | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 07c4f86c..126d077c 100644 --- a/package.json +++ b/package.json @@ -22,16 +22,25 @@ "./dist/socket.io.js": "./dist/socket.io.js", "./dist/socket.io.js.map": "./dist/socket.io.js.map", ".": { - "types": "./build/esm/index.d.ts", "import": { + "types": "./build/esm/index.d.ts", "node": "./build/esm-debug/index.js", "default": "./build/esm/index.js" }, - "require": "./build/cjs/index.js" + "require": { + "types": "./build/cjs/index.d.ts", + "default": "./build/cjs/index.js" + } }, "./debug": { - "import": "./build/esm-debug/index.js", - "require": "./build/cjs/index.js" + "import": { + "types": "./build/esm/index.d.ts", + "default": "./build/esm-debug/index.js" + }, + "require": { + "types": "./build/cjs/index.d.ts", + "default": "./build/cjs/index.js" + } } }, "types": "./build/esm/index.d.ts", diff --git a/tsconfig.json b/tsconfig.json index 89f1157b..e9a43ecc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "outDir": "build/cjs/", "target": "es2018", // Node.js 10 (https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping) "module": "commonjs", - "declaration": false, + "declaration": true, "esModuleInterop": true }, "include": [