flauwekeul / honeycomb

Create hex grids easily, in node or the browser.

Home Page:https://abbekeultjes.nl/honeycomb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Types not working on import

SevYote opened this issue Β· comments

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.

Thanks. I'll look into it later.

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

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

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

ts docs

Sorry for the late fix 😬

πŸŽ‰ This issue has been resolved in version 4.1.2 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

commented

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

Ugh πŸ˜’ I should've tested it. Trying to fix it now.

πŸŽ‰ This issue has been resolved in version 4.1.3 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

<3