From d0fbd3814057aed543698bf2b1fc27f2920d5bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rouven=20We=C3=9Fling?= Date: Sun, 17 Jun 2018 22:06:06 +0200 Subject: [PATCH] Only set prop types in non-production builds. This will enable a bundler to omit the prop-types import. --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index d25e416..a96a387 100644 --- a/index.js +++ b/index.js @@ -22,9 +22,11 @@ function DocumentTitle() {} DocumentTitle.prototype = Object.create(React.Component.prototype); DocumentTitle.displayName = 'DocumentTitle'; -DocumentTitle.propTypes = { - title: PropTypes.string.isRequired -}; +if (process.env.NODE_ENV !== 'production') { + DocumentTitle.propTypes = { + title: PropTypes.string.isRequired + }; +} DocumentTitle.prototype.render = function() { if (this.props.children) {