Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

expression-file doesn't seem to work; 'Couldn't load module "undefined"' #65

Open
mnpenner opened this issue Jun 6, 2017 · 5 comments · May be fixed by #168
Open

expression-file doesn't seem to work; 'Couldn't load module "undefined"' #65

mnpenner opened this issue Jun 6, 2017 · 5 comments · May be fixed by #168

Comments

@mnpenner
Copy link

mnpenner commented Jun 6, 2017

I'm trying

dts-gen --expression-file ./index.js

But I get

Couldn't load module "undefined". Please install it globally (npm install -g undefined) and try again.

Which doesn't make much sense.

How can I generate a .d.ts file for my library without having to globally install it first?

@trivikr
Copy link

trivikr commented Aug 15, 2017

Hi, any update on this?
I'm also facing similar issue while trying to generate .d.ts files

@dtgriscom
Copy link

I'm in the same boat. Any suggestions on what might be going wrong? (If it's caused by a specific line in the .js file, a line number would be great...)

@DavidNorena
Copy link

and your solution guys was ?

@ayqy
Copy link

ayqy commented Dec 20, 2018

@DavidNorena It's likely that there are relative path require() statements in expression-file, and would not be correctly resolved.

Just transform to absolute path to do the tricks, for example:

$ dts-gen -e "require('./dist/umd/emoutils.js')"
Couldn't load module "undefined". Please install it globally (npm install -g undefined) and try again.
# Change to Absolute Path
$ dts-gen -e "require('/absolute-path-to/emoutils.js')"
Wrote 52 lines to dts_gen_expr.d.ts.

Or dive into source and specify a correct cwd to fix this issue.

@hotfix519
Copy link

I also encountered this issue. My issue was also with unresolved dependencies. I had not run npm install on the repo I was trying to run dts-gen on. After I did so, the issue resolved.

@aminya aminya linked a pull request Apr 22, 2021 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants