Similar to Tree shaking create-react-app? but more of how to validate and fix.
So I have a created a library of react hooks. In there I added an example to help me understand how tree-shaking would work.
import { useClock, useDeepState } from '@trajano/react-hooks';
export function App(): JSX.Element {
useClock();
useDeepState("foo");
return <div>Hello world</div>
}
However, there’s a function called useAsyncSetEffect
that I added in my library code base, but tracing through the code for useClock
and useDeepState
I don’t hit that function at all, but when I look at the generated files I see a reference to useAsyncSetEffect
.
Not really sure what’s causing it, the library isn’t large so the size is just a K gzipped, but I am curious as to why it is being included.