Closed clayrisser closed 3 years ago
Maybe this is related to issue #118
hey! I notice in the output that you don't have a TSconfig defined. Is there a TS config option that would get this to work; if so, then you could supply the path to the TS config file and see if that works. If the file is pure commonjs, then it relies on the commonjs resolution algorithm (which handles the case you're mentioning). Since the "../src" module is going through TS proper: https://github.com/dependents/node-filing-cabinet/blob/master/index.js#L221, there might be a TS thing you need to set in a TS config. Let me know if that works at all.
The following worked for me:
const tree = dependencyTree.toList(
{
filename,
tsConfig: {
compilerOptions: {
allowSyntheticDefaultImports: true,
module: 'commonjs',
}
},
directory: './src',
nonExistent: non,
},
);
Thanks for closing the loop @jeanlescure.
If anyone wants to add docs to the readme to clarify this or help someone with a similar issue in the future, then I'd gladly review a PR. Cheers!
I am unable to resolve the dependency if I'm importing a directory with an
index.ts
file.For example . . . src/index.ts
tests/index.ts
Instead, what I have to do to make it work is explicitly import the index, which is less ideal. src/index.ts
tests/index.ts
Here is the debug log for running the following command.