hegel icon indicating copy to clipboard operation
hegel copied to clipboard

Path "stream" cannot be resolved

Open takase1121 opened this issue 5 years ago • 7 comments

Cool project, but:

Path "stream" cannot be resolved

I installed @types/node but it doesn't seem to detect it? I am confused.

takase1121 avatar Jul 10 '20 08:07 takase1121

~~After some investigation, I cannot find any part of the code (at least for module resolver) that supports loading a d.ts file. Maybe the docs is misleading me?~~

EDIT: I was VERY wrong and don't know what I was saying. sorry for that

takase1121 avatar Jul 10 '20 12:07 takase1121

this is how you do it https://github.com/JSMonk/hegel/blob/master/packages/cli/.hegelrc#L7-L9

thecotne avatar Jul 10 '20 13:07 thecotne

@thecotne the problem is that is the wrong folder to search for. the structure of the folder is @types > (module name) > (name from package.json).d.ts. This means that require.resolve is unable to find it because the path is hard coded here, not to mention that the config specified by typings might not actually go through here which is required to get typings from the node module.

takase1121 avatar Jul 10 '20 13:07 takase1121

I suggest that the user typings and node_modules be handled seperately. the code is kind of confusing to get around

takase1121 avatar Jul 10 '20 13:07 takase1121

@takase1121, we still work for full support of Node.js native modules, so, I will check the stream module today and will notify you about changes as soon as possible :)

JSMonk avatar Jul 10 '20 14:07 JSMonk

No worries, if you ever need help, I can try my best to help. I am currently testing some code to support DefinitelyTyped, if it works I'll consider opening a PR.

takase1121 avatar Jul 10 '20 22:07 takase1121

hi! i have a repo with flow types that i tried using hegel on.

i'm getting a similar error:

$ npx hegel
Path "net" cannot be resolved

maybe there is a common solution, but i could create a separate issue, if needed. thanks!

brandly avatar Nov 11 '20 21:11 brandly