babel-plugin-flow-react-proptypes icon indicating copy to clipboard operation
babel-plugin-flow-react-proptypes copied to clipboard

Perform escape analysis on imported types

Open brigand opened this issue 7 years ago • 3 comments

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.

brigand avatar Sep 12 '18 19:09 brigand

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.

johnpangalos avatar Feb 19 '21 09:02 johnpangalos

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

johnpangalos avatar Feb 19 '21 09:02 johnpangalos

Seems to actually just with files that don't have react components in them.

johnpangalos avatar Feb 19 '21 11:02 johnpangalos