aleclarson / vite-tsconfig-paths

Support for TypeScript's path mapping in Vite
MIT License
1.24k stars 43 forks source link

type declaration missing in package.json exports #62

Closed gunters63 closed 1 year ago

gunters63 commented 1 year ago

I am currently converting my Typescript project to fully ESM ("type": "module" in package.json and "moduleResolution": "Node16" in tsconfig).

The import statement:

import tsconfigPaths from 'vite-tsconfig-paths';

now gives me the following error message:

Could not find a declaration file for module 'vite-tsconfig-paths'. 'D:/proj/AtlasCopco/EnsoUi/node_modules/.pnpm/vite-tsconfig-paths@3.5.0_vite@3.0.4/node_modules/vite-tsconfig-paths/dist/index.mjs' implicitly has an 'any' type.

I looked in the package.json of vite-tsconfig-paths and it seems there is a type declaration missing for the exports:

  "exports": {
    "import": "./dist/index.mjs",
    "require": "./dist/index.js"
  },

If I manually change this to:

  "exports": {
    "types": "./dist/index.d.ts",
    "import": "./dist/index.mjs",
    "require": "./dist/index.js"
  },

the error goes away.

aleclarson commented 1 year ago

PR welcome!

IgnusG commented 1 year ago

This fix appears to be merged but a new version was not released yet

aleclarson commented 1 year ago

Released in v3.5.1