Workiva / react-dart

Dart Bindings for React JS
BSD 2-Clause "Simplified" License
413 stars 67 forks source link

CPLAT-11281 Only include propTypes in DDC output #258

Closed aaronlademann-wf closed 4 years ago

aaronlademann-wf commented 4 years ago

NOTE: We need to coordinate the release of these changes with updates to the logsPropError* matchers in over_react_test so that consumer tests asserting propTypes logging running in dart2js don't start to fail.

Problem

propTypes are a dev-only tool that do nothing when react_dom_with_react_dom_prod.js is utilized. That production build of react is most commonly used alongside a production deploy of Dart code compiled with dart2js.

Currently, the propTypes maps remain in the dart2js output - adding unnecessary bulk to consumer module(s).

Solution

Wrap the access to Component2.propTypes in an assert() so that they are included in JS compiled using DDC, but not dart2js.

Boy Scoutin'

aaronlademann-wf commented 4 years ago

Just FYI - the dev SDK travis build is failing e'where - it is unrelated to the changes in this PR.