From c249fa774353658659dda08be0d99d3a589f9d7c Mon Sep 17 00:00:00 2001 From: Ryan Lee Date: Sun, 6 Oct 2024 11:40:58 -0400 Subject: [PATCH] chore: output esm as modules --- package.json | 4 ++-- rollup.config.js | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 165bf2ba15..84dc2ba188 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,11 @@ "description": "JavaScript/TypeScript client SDK for LiveKit", "main": "./dist/livekit-client.umd.js", "unpkg": "./dist/livekit-client.umd.js", - "module": "./dist/livekit-client.esm.mjs", + "module": "./dist/esm/index.mjs", "exports": { ".": { "types": "./dist/src/index.d.ts", - "import": "./dist/livekit-client.esm.mjs", + "import": "./dist/esm/index.mjs", "require": "./dist/livekit-client.umd.js" }, "./e2ee-worker": { diff --git a/rollup.config.js b/rollup.config.js index a87f441d07..b91947a0fb 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -38,10 +38,13 @@ export default { input: 'src/index.ts', output: [ { - file: `dist/${packageJson.name}.esm.mjs`, - format: 'es', + dir: `dist/esm`, + format: "es", strict: true, sourcemap: true, + preserveModules: true, + preserveModulesRoot: 'src', + entryFileNames: "[name].mjs", }, { file: `dist/${packageJson.name}.umd.js`,