Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to resolve index.tsx dependencies #118

Open
Sharabesh opened this issue May 9, 2020 · 4 comments
Open

Unable to resolve index.tsx dependencies #118

Sharabesh opened this issue May 9, 2020 · 4 comments

Comments

@Sharabesh
Copy link

Sharabesh commented May 9, 2020

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: pahen/madge#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',
  ...
  '../..' ]
@Sharabesh Sharabesh changed the title Unable to resolve index.ts dependencies Unable to resolve index.tsx dependencies May 9, 2020
@mrjoelkemp
Copy link
Collaborator

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.

@lo1tuma
Copy link

lo1tuma commented Jan 23, 2021

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.

@lo1tuma
Copy link

lo1tuma commented Jan 24, 2021

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' } } });

@jeanlescure
Copy link

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,
  },
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants