Tomato6966 / lavalink-client

Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.
https://tomato6966.github.io/lavalink-client/
MIT License
48 stars 13 forks source link

Module is not resolved correctly in WebStorm #12

Closed MeridianGH closed 9 months ago

MeridianGH commented 10 months ago

The module is not resolved correctly and listed as "not installed" in WebStorm, even tho it is installed correctly and listed in package.json:

grafik

This is a bit problematic since types (or type hints) are not imported because of this. The package is however still working as usual.

Any idea why this might happen?

Tomato6966 commented 10 months ago

I certainly do not have an idea. (Will do some research)

MeridianGH commented 9 months ago

I did some testing and it seems it has something to do with the way the structures are exported.

If I manually place an index.js in the module's root folder (i.e. not in /dist), WebStorm correctly recognizes it as a module.

I can then use

import * as lavalink-client from 'lavalink-client'

and then access the structures using

new lavalink-client.__esModule.LavalinkManager(...)

\ I guess this is either due to the module's Typescript configuration or the way exports are handled. Either way, this is slightly above me since I never really worked with Typescript before.

Tomato6966 commented 9 months ago

I think it has to do something with webstorm

MeridianGH commented 9 months ago

Most certainly, yes. Although I don't think this is a commonly known issue and other module seem to work fine.

Importing from lavalink-client/dist also works fine.

I think it has something to do with the way the module is exported to /dist

Seems like it works fine now.

Tomato6966 commented 9 months ago

image Maybe it's because of the package.json

MeridianGH commented 9 months ago

Could be. You could try exporting the individual parts directly in the root folder, i.e. just /cjs/index.js or /types/index.d.ts.

That doesn't solve the issue tho, that the regular index.js is still in the /dist subdirectory...

Tomato6966 commented 9 months ago

I am exporting the projects correclty

if you have module enabled it is getting imported through dist/esm if not aka you code in cjs, it uses main..