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'
Deprecated registerComponent. This should have been deprecated when Component was - but we missed it.
Problem
propTypes
are a dev-only tool that do nothing whenreact_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 anassert()
so that they are included in JS compiled using DDC, but not dart2js.Boy Scoutin'
registerComponent
. This should have been deprecated whenComponent
was - but we missed it.