DEV Community

Discussion on: 🦥 React.lazy without a default export

Collapse
 
gollyjer profile image
Jeremy Gollehon

Does this have an affect on tree-shaking?

Collapse
 
iamandrewluca profile image
Andrei Luca

Yes. Dynamic import cannot be analyzed at build time.
You will have to follow React Docs and reexport only wanted component to have dynamic import with tree shaking
reactjs.org/docs/code-splitting.ht...

Collapse
 
gollyjer profile image
Jeremy Gollehon

Excellent. Thanks for the link.