From 413de4478b3158fef3a98ee0dfd2c0beecac70d4 Mon Sep 17 00:00:00 2001 From: Anton Golub Date: Sun, 30 Jun 2024 20:05:44 +0300 Subject: [PATCH 1/3] feat: provide pkg entry points for import API --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index 364436b6..5a118155 100644 --- a/package.json +++ b/package.json @@ -27,12 +27,14 @@ "exports": { ".": { "types": "./dist/index.d.ts", + "import": "./browser/index.js", "node": "./dist/index.js", "default": "./browser/index.js" }, "./package.json": "./package.json", "./util": { "types": "./dist/util.d.ts", + "import": "./browser/dist/util.js", "node": "./dist/util.js", "default": "./browser/dist/util.js" } From b4738560f02481b18ca028abbab6785f7816e638 Mon Sep 17 00:00:00 2001 From: Anton Golub Date: Mon, 1 Jul 2024 09:55:41 +0300 Subject: [PATCH 2/3] fix: add conditional exports for node --- package.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 5a118155..a91d0de0 100644 --- a/package.json +++ b/package.json @@ -27,15 +27,19 @@ "exports": { ".": { "types": "./dist/index.d.ts", - "import": "./browser/index.js", - "node": "./dist/index.js", + "node": { + "import": "./browser/index.js", + "require": "./dist/index.js" + }, "default": "./browser/index.js" }, "./package.json": "./package.json", "./util": { "types": "./dist/util.d.ts", - "import": "./browser/dist/util.js", - "node": "./dist/util.js", + "node": { + "import": "./browser/dist/util.js", + "require": "./dist/util.js" + }, "default": "./browser/dist/util.js" } }, From 04e515475327527bedb39823a856374f0aea4a4d Mon Sep 17 00:00:00 2001 From: Anton Golub Date: Thu, 4 Jul 2024 22:41:59 +0300 Subject: [PATCH 3/3] refactor: use separate prefix for esm package entries --- package.json | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index a91d0de0..8640c385 100644 --- a/package.json +++ b/package.json @@ -27,19 +27,21 @@ "exports": { ".": { "types": "./dist/index.d.ts", - "node": { - "import": "./browser/index.js", - "require": "./dist/index.js" - }, + "node": "./dist/index.js", "default": "./browser/index.js" }, "./package.json": "./package.json", "./util": { "types": "./dist/util.d.ts", - "node": { - "import": "./browser/dist/util.js", - "require": "./dist/util.js" - }, + "node": "./dist/util.js", + "default": "./browser/dist/util.js" + }, + "./esm": { + "types": "./dist/index.d.ts", + "default": "./browser/index.js" + }, + "./esm/util": { + "types": "./dist/util.d.ts", "default": "./browser/dist/util.js" } },