From 46ef8512edac758069ed4d519f7517bafbace4a9 Mon Sep 17 00:00:00 2001 From: Tyler Butler Date: Mon, 6 Nov 2023 14:18:25 -0800 Subject: [PATCH] fix: improve compatibility with node16 module resolution (#711) Related: - https://github.com/microsoft/TypeScript/issues/46770#issuecomment-966612103 - https://github.com/socketio/socket.io-client/issues/1589 --- package.json | 16 +++++++++++++--- tsconfig.json | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 9fe1e2d8f..d5414f0ea 100644 --- a/package.json +++ b/package.json @@ -12,14 +12,24 @@ "./dist/engine.io.min.js": "./dist/engine.io.min.js", ".": { "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 89f1157b7..e9a43ecc3 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": [