line / ts-remove-unused

Remove unused code from your TypeScript project
Apache License 2.0
990 stars 12 forks source link

bug: dynamic imports aren't recognized #27

Closed rafaeelaudibert closed 1 month ago

rafaeelaudibert commented 1 month ago

My codebase has a lot of lazy loading through React using dynamic imports.

image

ts-remove-unused doesn't detect them and considers the imported files to be unused. For reference, https://github.com/stauren/vite-plugin-deadfile detects them just fine.

kazushisan commented 1 month ago

@rafaeelaudibert I think its not limited to react.lazy but more about dynamic imports in general. thanks for reporting! will work on a fix