flauwekeul / honeycomb

Create hex grids easily, in node or the browser.
https://abbekeultjes.nl/honeycomb
MIT License
639 stars 59 forks source link

Types not working on import #103

Closed SevYote closed 1 year ago

SevYote commented 1 year ago

Heya, ran into some issues trying out honeycomb-grid where imports didn't seem to be working right, which ultimately lead me to this thread.

I used patch-package to patch honeycomb-grid@4.1.1 as shown in the diff below. That got me going, but I'm not sure if that's actually the proper / ideal way to do it. Hopefully it gets you down the right path to a fix, though. This site from that thread gives some more info.

diff --git a/node_modules/honeycomb-grid/package.json b/node_modules/honeycomb-grid/package.json
index 5f36957..c0f71dd 100644
--- a/node_modules/honeycomb-grid/package.json
+++ b/node_modules/honeycomb-grid/package.json
@@ -8,7 +8,10 @@
   "types": "dist/index.d.ts",
   "exports": {
     ".": {
-      "import": "./dist/honeycomb-grid.mjs",
+      "import": {
+        "default": "./dist/honeycomb-grid.mjs",
+        "types": "./dist/index.d.ts"
+      },
       "require": "./dist/honeycomb-grid.umd.js"
     }
   },

This issue body was partially generated by patch-package.

flauwekeul commented 1 year ago

Thanks. I'll look into it later.

SIGSTACKFAULT commented 1 year ago

just deleting the exports block also fixed it for me. I'm not sure why it worked before.

SIGSTACKFAULT commented 1 year ago

upgrading to TS5 fixed it for me, but I couldn't repro the problem at all in a blank project so /shrug the problem spontaneously came back five minutes later with no changes

SIGSTACKFAULT commented 1 year ago

adding "resolvePackageJsonExports": false to my tsconfig fixed it for me

ts docs

flauwekeul commented 1 year ago

Sorry for the late fix 😬

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 4.1.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Altrue commented 1 year ago

Unfortunately this is not fixed @flauwekeul, the package.json references a file located at "./dist/index.d.ts" but the file is actually located at "./src/dist/index.d.ts"

Sorry haha ;D

flauwekeul commented 1 year ago

Ugh 😒 I should've tested it. Trying to fix it now.

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 4.1.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

SIGSTACKFAULT commented 1 year ago

<3