Perform escape analysis on imported types
Reference: react-virtualized issue
This import appears in a source file which doesn't define components or composite types.
import type WindowScroller from '../WindowScroller.js';
This line is in the output:
import { bpfrpt_proptype_WindowScroller } from '../WindowScroller.js';
As bpfrpt_proptype_WindowScroller is never referred to, the binding and import can be cleaned up.
Hey, thought I'd follow up on this as more things are starting to use esbuild which is incompatible with this behavior. Resulting in anyone using react-virtualized not being able to use some of the more modern tooling. Some effect tools: esbuild, vite, and snowpack.
I would love to help in anyway I can including writing code. But I am not sure how to go about this.
Looking through the code for react-virutalized, it seems to only happen for default imports of types.
Reference: https://github.com/bvaughn/react-virtualized/blob/master/source/WindowScroller/utils/onScroll.js
@mewhhaha
Seems to actually just with files that don't have react components in them.