node-dependency-tree
node-dependency-tree copied to clipboard
Unable to resolve index.tsx dependencies
I'm having trouble running this package over dependencies that include in index.tsx file as I'm getting the error:
tree skipping an empty filepath resolution for partial: components/lib +29ms
My index.tsx in components/lib just consists of export * from ___ lines.
I saw this similar issue here: https://github.com/pahen/madge/issues/128 but it didn't seem to have a solution. Any ideas on this?
In the debug output i'm seeing:
tree deduped list of nonExistent partials: [
'components/lib',
...
'../..' ]
hey! I don't use TS sadly, so I'd need a failing test in order to concretely understand what's not working. Any help is appreciated.
I’m having the same problem while trying to determine the dependency tree of a .d.ts files. Dependencies to folders don’t resolve to the respective index.d.ts file. Would be nice to somehow configure the file extension. The nonExistent list is also not helpful in this case because it only contain relative paths but without the information from which path it was imported.
I was able to resolve my issue with .d.ts files. Although I don’t have a tsconfig file for them, there is the possibility to provide a tsconfig object instead of a file, so the following tsconfig makes sure that index files are resolved correctly:
dependencyTree.toList({ filename: myFile, directory: myDir, tsConfig: { compilerOptions: { module: 'CommonJS' } } });
I'm working on a project where I use only tsc arguments on CLI (as in no tsconfig file), the following worked for me:
const tree = dependencyTree.toList(
{
filename,
tsConfig: {
compilerOptions: {
allowSyntheticDefaultImports: true,
module: 'commonjs',
}
},
directory: './src',
nonExistent: non,
},
);