komodojp / tinyld

Simple and Performant Language detection library for NodeJS
https://komodojp.github.io/tinyld/
MIT License
415 stars 12 forks source link

Types can't be found for tinyld/light #22

Closed urlDev closed 1 year ago

urlDev commented 1 year ago

Hey,

After comparing against multiple different packages/APIs, I decided to go with tinyld for my project, great work! However, when I wanted to import and use tinyld/light, I bumped into issues regarding type declarations.

Cannot find module 'tinyld/light' or its corresponding type declarations.

Looking at the package.json, I can see that you have declared type destination but seems like there is an issue about that regarding exports/paths.

kefniark commented 1 year ago

Ok probably just some config issue in package.js, I will try to take a look at that later. Just to check, do you use ESM or commonjs? and which version of NodeJS version are you using?

Meanwhile you can use tinyld, type should be working and api are the same

kefniark commented 1 year ago

Indeed I found something off, some package.json fields like "main" and "exports" were apparently fighting each other. I published a new version to fix this issue.

You can install it with: yarn add tinyld@1.3.4 or npm install tinyld@1.3.4 Can you give a try it and see if it solve your problem.

To double check, I also created a small sample project to reproduce the problem, and it seems to be working fine:

urlDev commented 1 year ago

I installed and checked it in my local as well, and works as expected. Great job!