only add import references when they are used (#8874)
### Description
skips import to modules that are side effect free and have no exports
referenced
This allows to e. g. skip the `package` import completely in the
following code:
``` js
import { something } from "package"; // package is marked as side effect free
if (falsy) {
something();
}
```
This could happen e. g. with code like `if(process.env.NODE_ENV ===
"production")`
### Testing Instructions
<!--
Give a quick description of steps to test your changes.
-->