moroshko / react-scanner

Extract React components and props usage from code.
MIT License
563 stars 40 forks source link

reactjs component is not getting recognised when its used as under lazy loading #57

Open raghavendra87 opened 1 year ago

raghavendra87 commented 1 year ago

Hi Dev,

Few of the components are not getting recognized. When used as lazy loading component.

const SamplePage= lazy(() => import('./Sample/components/index'));

Used as route like

I tried using escodegen.generate(node.expression) but it only returns the constant to find the actual component.

This component is not getting added to raw report.

But when i changed it to import SamplePagefrom './SamplePage/components/index'; the component getting recognized. But there are so many like i cant use this.

Can you please suggest how to add this to the component tree ?

Can you please do some youtube on customization and executing constant defined in the module to inject them in jsx.

Thank you for the work much useful for us.

cbfrance commented 1 year ago

I also have this problem, in my case it results in most of my components not being counted.

The repo I am trying to set up has webpack's optimized / lazy imports like this:

OrgMembers: lazy( () => import(/* webpackChunkName: 'org-users-vNext' */ './users/OrgMembers') ),