gluegun
gluegun copied to clipboard
Commands fails when definition files are preset
Here is the case
I would have the following files
/commands
build.d.ts
build.js
For some reason here
https://github.com/infinitered/gluegun/blob/e30b03f0292ab52124a1076952126456655c6459/src/loaders/module-loader.ts#L13-L14 Node is actually requiring the .d.ts
file instead of the JavaScript file. 🤷♂️
Node version: v10.10.0
are you running your cli via node
or ts-node
? ts-node
does some weird things with requires.
I tried out a sample directory without gluegun or a gluegun cli with run.js
, run.ts
, build.ts
, and build.d.ts
. run.{js,ts}
each have the same code that does a require('./build')
. node run.js
returns the correct output but ts-node run.ts
does not. ts-node run.ts
does a require of the build.d.ts
file instead.
@cmckni3 does work using ts-node
since that is why the file is not .ts
files.
But once I use the compiled version (node
) it doesn't work
I’ll have to check tomorrow. I think I meant build.js
and build.d.ts
@yordis Did #420 fix your issue here? Or, rather, would it have, if it had been there when you started using Gluegun?
@jamonholmgren the issue is actually happening on the released version of the package ... I need to replicate it again since I just pull out the .d.ts
out of the released version.
This makes no-sense unless ts-node
is present, let me dig in, maybe was me being stupid 😄
@jamonholmgren confirmed, this behavior is happening and it is not using node-ts
. I will try to put an example project for you,
@cmckni3 @jamonholmgren you could fork https://github.com/straw-hat-team/fetcher and downgrade to "@straw-hat/cli": "0.10.1"
since that version has declarations on it.
Run yarn release
and notice that it will fail.
@yordis I'm not sure I'll have time to tackle this soon. Would you want to see if you can figure out a solution?