endojs / Jessie

Tiny subset of JavaScript for ocap-safe universal mobile code
Apache License 2.0
279 stars 16 forks source link

exports map breaks types downstream #118

Open turadg opened 4 months ago

turadg commented 4 months ago

Firstly, thanks for your work on this project! 😉

Today I used patch-package to patch jessie.js@0.3.4 for the project I'm working on.

Switching agoric-sdk moduleResolution from node to bundler caused the resolver to fail to find the exports of the jessie.js package. A work-around was to remove the exports map.

By default patch-package ignores package.json so this diff was made with yarn patch-package --exclude nothing

diff --git a/node_modules/jessie.js/package.json b/node_modules/jessie.js/package.json
index 24f0881..da02cf8 100644
--- a/node_modules/jessie.js/package.json
+++ b/node_modules/jessie.js/package.json
@@ -16,10 +16,6 @@
   },
   "main": "./src/main.js",
   "types": "./types/main.d.ts",
-  "exports": {
-    "./package.json": "./package.json",
-    ".": "./src/main.js"
-  },
   "scripts": {
     "build": "yarn build:types",
     "build:types": "tsc -p jsconfig.build.json --outDir types",

There may be a better solution so I'm just filing this as an issue instead of a PR.