Internal React components that are not exported

I have a bunch of internal React components that are used to assemble the component that I will export to Dash. When I generate the python class, I got a bunch of these errors:

dash-generate-components ./src/lib/components analysis_filters -p package-info.json --ignore .test.

TypeError: Cannot convert undefined or null to object
TypeError: Cannot convert undefined or null to object
at Function.keys ()
at parseJSX (/Users/joechan/code/analysis_filters/.venv/lib/python3.8/site-packages/dash/extract-meta.js:137:16)
at gather (/Users/joechan/code/analysis_filters/.venv/lib/python3.8/site-packages/dash/extract-meta.js:157:47)

I tracked it down to react-docgen, and it expects every module to have PropTypes, even though they are never meant to be used by Dash directly. These components are implementation details, and should not be exposed. Is there anyway I can get around this, both to not generate the python class and avoid these errors?

Hello @Joechan,

Try putting these building pieces into another directory inside the components folder, and then update your path for the imports accordingly.

I finally figured it out digging into the dash code. What I needed to do is to change the npm build command to add the right regexp into dash-generate-components. E.g., I put files in the _internals/ directory, and I change the argument to:

–ignore \.test\.\|_internals

1 Like