antoine-coulon / skott

All-in-one devtool to automatically analyze, search and visualize project modules and dependencies from JavaScript, TypeScript (JSX/TSX) and Node.js (ES6, CommonJS)
MIT License
669 stars 25 forks source link

Does not include .tsx deps when extension in import statement #29

Closed amized closed 1 year ago

amized commented 1 year ago

Thanks for the tool - I'm trying to run this over a react/typescript project with many .tsx dependencies.

Unfortuantely it seems the tool misses out when we import a tsx file without specifying the extension.

E.g. we have a file called SurveyVideo.tsx, and another file that imports it:

// Does not include SurveyVideo.tsx in the dep graph 
import * from "./SurveyVideo";
// Works
import * from "./SurveyVideo.tsx";

Can we get around this with the current config or is this a bug?

antoine-coulon commented 1 year ago

Hello, thanks for reporting the issue @amized !

It's indeed not a bug nor a configurable thing, it's just a part of module resolution spec that was not implemented yet 🤦🏻‍♂️

TSX/JSX support from Skott is pretty new so there might be other issues, feel free to report them as well :)

By the way, I'm already working on a quick implementation to resolve that issue. This will be included in a patch release tonight or tomorrow.

antoine-coulon commented 1 year ago

@amized I just released a patch version 0.19.1 that should fix the module resolution problem.

Could you please try with it and let me know if that fixes the issue? Thanks

amized commented 1 year ago

hi @antoine-coulon I just tried again, now it's not picking up any imports:

$ skott --fileExtensions=.ts,.tsx src/pages/_app.tsx

Screenshot 2023-03-29 at 10 02 52 AM

antoine-coulon commented 1 year ago

Hello @amized, could you please share a repro of your project or at least paste the content of your src/pages/_app.tsx? I can't reproduce that behavior on a project I got locally running with Next.js and TypeScript Thanks!

antoine-coulon commented 1 year ago

@amized

It could also be to a tsconfig issue if you're ever using path aliases. Could you also paste it there to make the troubleshooting easier?

You might also want to try skott --fileExtensions=.ts,.tsx src/pages/_app.tsx --trackThirdPartyDependencies to check if some alias are considered third-party by Skott (which might be the case when path aliases could not be resolved correctly)

antoine-coulon commented 1 year ago

Closing this as the problem should be outdated with latest releases. Feel free to re-open the issue if the problem persists