Open ryan-tote opened 1 week ago
This is expected behavior.
Did you try your luck by adding --include-libs
? Your CSB doesn't have a terminal so I can't try.
Oh interesting, didn't know that.
I saw that dynamic imports don't work on the docs https://knip.dev/guides/handling-issues#dynamic-import-specifiers but this isn't exactly a dynamic import.
--include-libs
does work but incurs a performance penalty. Does seem a bit weird that we need to add that flag since this isn't library code.
This mode is disabled by default, because it incurs a performance penalty.
Docs should be improved, indeed this isn't only about library code.
Glad it does seem to do the trick for you!
Prerequisites
Reproduction url
https://codesandbox.io/p/sandbox/ls97j5?file=%2Fsrc%2FApp.tsx%3A25%2C5
Reproduction access
Description of the issue
An ordinary react lazy where the import path is inside the function works fine.
But when you move the import path to a separate function it no longer follows the function path.
Knip believes that the Button component is not being used so it flags it up as an unused export