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

Typescript types are not properly exported #74

Open
SnirShechter opened this issue Jul 20, 2023 · 3 comments · May be fixed by #75
Open

Typescript types are not properly exported #74

SnirShechter opened this issue Jul 20, 2023 · 3 comments · May be fixed by #75

Comments

@SnirShechter
Copy link

SnirShechter commented Jul 20, 2023

Could not find a declaration file for module 'vite-plugin-eslint'.
'c:/Code/react-vite-example/node_modules/vite-plugin-eslint/dist/index.mjs' implicitly has an 'any' type.
There are types at 'c:/Code/react-vite-example/node_modules/vite-plugin-eslint/dist/index.d.ts',
but this result could not be resolved when respecting package.json "exports".
The 'vite-plugin-eslint' library may need to update its package.json or typings.ts(7016)
image
@SnirShechter SnirShechter linked a pull request Jul 20, 2023 that will close this issue
@SnirShechter
Copy link
Author

For anyone else stuck here, I've added a fix myself via patch-package:

  1. npm install --save-dev patch-package
  2. Create the patch file patches/vite-plugin-eslint+1.8.1.dev.patch with this content:
diff --git a/node_modules/vite-plugin-eslint/package.json b/node_modules/vite-plugin-eslint/package.json
index afbc41c..5f6d8f7 100644
--- a/node_modules/vite-plugin-eslint/package.json
+++ b/node_modules/vite-plugin-eslint/package.json
@@ -9,6 +9,7 @@
   "types": "./dist/index.d.ts",
   "exports": {
     ".": {
+      "types": "./dist/index.d.ts",
       "import": "./dist/index.mjs",
       "require": "./dist/index.js"
     }
  1. Add a postinstall script in your package.json:
"postinstall": "patch-package",
  1. npm install

@mrlika
Copy link

mrlika commented Oct 2, 2023

It happens when using recommended in TypeScript 5 "moduleResolution": "Bundler" in tsconfig.json

@thany
Copy link

thany commented Apr 9, 2024

What does it take to get this fixed? It seems like an easy thing to fix...

I don't really want to use a patch-package mechanism, since I'm setting up a totally new virgin project. It feels dirty.

johnnywwy added a commit to johnnywwy/water-drop-mobile that referenced this issue Apr 28, 2024
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

Successfully merging a pull request may close this issue.

3 participants