json-edit-react icon indicating copy to clipboard operation
json-edit-react copied to clipboard

Missing default-branch in exports in package.json

Open dobretzberger opened this issue 1 year ago • 1 comments

Describe the bug In Version 1.16, the export-clause was introduced in the package.json using conditional exports for import, require and types. That leads to the problem that the library cannot be used in other enviroments, because the default-case is missing. In our case the import using shadow-cljs failes.

Node.js also recommends to add a default if possible, see https://nodejs.org/api/packages.html#conditional-exports

Expected behavior json-edit-react should provide a default case in exports

dobretzberger avatar Oct 11 '24 08:10 dobretzberger

Okay, thanks for the heads-up, I'll fix this next week (unless someone else wants to make a PR)

CarlosNZ avatar Oct 11 '24 08:10 CarlosNZ

Hi @dobretzberger -- I've updated this in v1.17.1. Can you confirm it's working okay for you?

CarlosNZ avatar Oct 20 '24 04:10 CarlosNZ

Oh, hey, I'm sorry. I got the Closed-Email, but no Notification of your responses between.

Im afraid your improvement doesn't help. (Testet with 1.17.2) But I did some investigation now, and it seems that the following replacement of exports in the package.json solves my problem:

  "exports": {
    ".": {
      "types": "./build/index.d.ts",
      "import": "./build/index.esm.js",
      "require": "./build/index.cjs.js",
      "default": "./build/index.esm.js"
    }
  },

Maybe this also helps for #128 ?

dobretzberger avatar Dec 11 '24 12:12 dobretzberger

@dobretzberger Thanks a lot for that suggestion. I've updated it to that in 1.17.3 if you'd like to give it a try.\

I have to say, I don't know too much about this kind of thing, and the online resources seem to be in a constant state of evolution. It's hard to get it working properly for every environment, so any help is appreciated.

CarlosNZ avatar Dec 11 '24 20:12 CarlosNZ

Yeah, that works. Thanks for the release!

Unfortunately, my knowledge about that stuff is also very limited...

dobretzberger avatar Dec 13 '24 08:12 dobretzberger

Yeah, that works. Thanks for the release!

Great to hear 🎉

CarlosNZ avatar Dec 13 '24 08:12 CarlosNZ