From 34e3da1d47b02eb7028fbd9c79a1693dffa052e1 Mon Sep 17 00:00:00 2001 From: Philzen Date: Wed, 11 Dec 2024 07:20:26 +0100 Subject: [PATCH 1/2] Fix ESM type declaration vs. CJS javascript file import mismatch See https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseESM.md --- packages/livekit-server-sdk/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/livekit-server-sdk/package.json b/packages/livekit-server-sdk/package.json index 181ec7f4..79eb85c5 100644 --- a/packages/livekit-server-sdk/package.json +++ b/packages/livekit-server-sdk/package.json @@ -11,7 +11,6 @@ "type": "module", "exports": { ".": { - "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs" } From d50ed0e70172819d9ac1986858b61e1a9e4ab599 Mon Sep 17 00:00:00 2001 From: Philzen Date: Wed, 11 Dec 2024 07:26:06 +0100 Subject: [PATCH 2/2] Generate .d.cts file by copying over .d.ts This is supposed to work according to `npx publint`: > 1. pkg.exports["."].require types is not exported. Consider adding > pkg.exports["."].require.types to be compatible with TypeScript's > "moduleResolution": "bundler" compiler option. Note that you cannot > use "./dist/index.d.ts" because it has a mismatching format. Instead, > you can duplicate the file and use the .cts extension, > e.g. pkg.exports["."].require.types: "./dist/index.d.cts" --- packages/livekit-server-sdk/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/livekit-server-sdk/package.json b/packages/livekit-server-sdk/package.json index 79eb85c5..19f56c06 100644 --- a/packages/livekit-server-sdk/package.json +++ b/packages/livekit-server-sdk/package.json @@ -20,7 +20,7 @@ "src" ], "scripts": { - "build": "tsup --onSuccess \"tsc --declaration --emitDeclarationOnly\"", + "build": "tsup --onSuccess \"tsc --declaration --emitDeclarationOnly && cp ./dist/index.d.ts ./dist/index.d.cts\"", "build:watch": "tsc --watch", "build-docs": "typedoc", "changeset": "changeset",