I'm building a dashboard for tracking components usages of my company's private UI kit.
And I'm having an issue when an import of a default export of the same component using different names results in the different components in the report:
// file_1.ts
import component_1 from "module-name";
// file_2.ts
import component_2 from "module-name";
will end up with:
{
component_1: {
},
component_2: {
},
}
Since the module name is the only way to uniquely identify components with default export I can suggest only few ideas:
use a module name as a component name
reuse already parsed name for the same module name
This PR allows users to choose their own naming strategy by providing a importType field along with other import data.
It can be used inside getComponentName callback or during processor step by merging data for components with the same module name and importType === 'ImportDefaultSpecifier'
Hey! Thanks for a great tool!
I'm building a dashboard for tracking components usages of my company's private UI kit.
And I'm having an issue when an import of a default export of the same component using different names results in the different components in the report:
will end up with:
Since the module name is the only way to uniquely identify components with default export I can suggest only few ideas:
This PR allows users to choose their own naming strategy by providing a
importType
field along with other import data.It can be used inside
getComponentName
callback or duringprocessor
step by merging data for components with the same module name andimportType === 'ImportDefaultSpecifier'