Closed MeridianGH closed 9 months ago
I certainly do not have an idea. (Will do some research)
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.
I think it has to do something with webstorm
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.
Maybe it's because of the package.json
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...
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..
The module is not resolved correctly and listed as "not installed" in WebStorm, even tho it is installed correctly and listed in
package.json
: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?