Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for TypeScript "moduleResolution": "NodeNext" #6

Open
psychobolt opened this issue Aug 27, 2024 · 0 comments
Open

Support for TypeScript "moduleResolution": "NodeNext" #6

psychobolt opened this issue Aug 27, 2024 · 0 comments

Comments

@psychobolt
Copy link

Types cannot be imported when moduleResolution is set to higher than node, I am getting a similar error as in microsoft/TypeScript#52363 . Seems like the only workaround at the moment is to patch the package.json:

diff --git a/package.json b/package.json
index 8df2034b73f181c8b0c8a18a9bd5e45284c42ff3..081952a7aaae11c2c643446d225524b6f6c040e7 100644
--- a/package.json
+++ b/package.json
@@ -26,8 +26,10 @@
     "types"
   ],
   "exports": {
-    ".": "./index.js",
-    "./types": "./types/*"
+    ".": {
+      "types": "./types/index.d.ts",
+      "default": "./index.js"
+    }
   },
   "engines": {
     "node": "^18.0.0 || >=20.0.0"

Seeing vite is also using the types field convention for their dual exports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant