Import directly from source files instead of barrel files to avoid loading thousands of unused modules. Barrel files are entry points that re-export multiple modules (e.g., index.js that does export from './module').
Popular icon and component libraries can have up to 10,000 re-exports in their entry file. For many React packages, it takes 200-800ms just to import them, affecting both development speed and production cold starts.
Why tree-shaking doesn't help: When a library is marked as external (not bundled), the bundler can't optimize it. If you bundle it to enable tree-shaking, builds become substantially slower analyzing the entire module graph.
Импортируйте непосредственно из исходных файлов, а не из файлов стволов. Применяйте при использовании таких библиотек, как lucide-react, @mui/material или @radix-ui/react-*, чтобы уменьшить размер пакета и сократить время загрузки разработки. Источник: theorcdev/8bitcn-ui.