Currently updating imports in a large project from the "named import" style:...


Currently updating imports in a large project from the "named import" style:

import { SelectInput } from "reusable";

to a direct import:

import SelectInput from "reusable/lib/SelectInput";

Why? Because named imports **import the entire library**.

#javascript
Ideally tools would just be able to eliminate unused code. In practice, I've found Webpack doesn't do it well.

In my example, "reusable" is a library of React components built via Rollup using my fork of: https://github.com/transitive-bullshit/create-react-library

Certainly welcome any suggestions.

View original on X