Skip to content

[flow] build size increase with 0.53 #7881

Description

@rosskevin

Problem description

With the recent change to flow 0.53, we encountered a small but perhaps unnecessary size increase. There are two sources of this:

  1. the conditional check for typeof seems quite long
  2. there are two assignments to propTypes

This was occurring before the PR #7869 as verified in the build package, but I assume the long typeof check pushed us up and over that limit.

This could be a bug in the plugin, or it could be a quirk with our usage.

Steps to reproduce

  1. yarn build
  2. open RadioGroup.js
  3. look at the bottom to find
RadioGroup.propTypes = process.env.NODE_ENV !== "production" ? (_ref2 = {
  classes: require('prop-types').object.isRequired,
  children: typeof (React.ChildrenArray == null ? {} : React.ChildrenArray) === 'function' ? require('prop-types').instanceOf(React.ChildrenArray == null ? {} : React.ChildrenArray) : require('prop-types').any
}, (0, _defineProperty3.default)(_ref2, 'classes', require('prop-types').object), (0, _defineProperty3.default)(_ref2, 'className', require('prop-types').string), (0, _defineProperty3.default)(_ref2, 'name', require('prop-types').string), (0, _defineProperty3.default)(_ref2, 'onBlur', require('prop-types').func), (0, _defineProperty3.default)(_ref2, 'onChange', require('prop-types').func), (0, _defineProperty3.default)(_ref2, 'onKeyDown', require('prop-types').func), (0, _defineProperty3.default)(_ref2, 'value', require('prop-types').string.isRequired), _ref2) : {};
RadioGroup.propTypes = process.env.NODE_ENV !== "production" ? (_ref3 = {
  classes: require('prop-types').object.isRequired,
  children: typeof (React.ChildrenArray == null ? {} : React.ChildrenArray) === 'function' ? require('prop-types').instanceOf(React.ChildrenArray == null ? {} : React.ChildrenArray) : require('prop-types').any
}, (0, _defineProperty3.default)(_ref3, 'classes', require('prop-types').object), (0, _defineProperty3.default)(_ref3, 'className', require('prop-types').string), (0, _defineProperty3.default)(_ref3, 'name', require('prop-types').string), (0, _defineProperty3.default)(_ref3, 'onBlur', require('prop-types').func), (0, _defineProperty3.default)(_ref3, 'onChange', require('prop-types').func), (0, _defineProperty3.default)(_ref3, 'onKeyDown', require('prop-types').func), (0, _defineProperty3.default)(_ref3, 'value', require('prop-types').string.isRequired), _ref3) : {};

Metadata

Metadata

Assignees

Labels

not plannedThe problem seems valid, but we don't intend to fix it (won't fix).

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions