Skip to content
Snippets Groups Projects
  • Joe Lencioni's avatar
    750071b5
    Remove propTypes in production · 750071b5
    Joe Lencioni authored
    This will help reduce the bundle size impact. Note that any consumers
    who are depending on any react-dates components having a `.propTypes`
    property will no longer work as expected after this change.
    
    I enabled this using wrap mode, which adds `process.env.NODE_ENV`
    checks, which is a pretty standard method for React apps. I believe this
    will allow this library to have propTypes in development, but for them
    to be minified out in production builds.
    
    To make this safe to enable in this repo, I enabled the
    react/forbid-foreign-prop-types ESLint rule, which was written
    specifically for the benefit of this plugin.
    
    Here's a diff showing what effect this has on the esm build:
    
      https://gist.github.com/lencioni/1b436d365570394ccde659c829ba02c3
    750071b5
    History
    Remove propTypes in production
    Joe Lencioni authored
    This will help reduce the bundle size impact. Note that any consumers
    who are depending on any react-dates components having a `.propTypes`
    property will no longer work as expected after this change.
    
    I enabled this using wrap mode, which adds `process.env.NODE_ENV`
    checks, which is a pretty standard method for React apps. I believe this
    will allow this library to have propTypes in development, but for them
    to be minified out in production builds.
    
    To make this safe to enable in this repo, I enabled the
    react/forbid-foreign-prop-types ESLint rule, which was written
    specifically for the benefit of this plugin.
    
    Here's a diff showing what effect this has on the esm build:
    
      https://gist.github.com/lencioni/1b436d365570394ccde659c829ba02c3