Reduce webpack bundle size: remove react prop types in production builds (#2036)

* Remove react prop types in production builds

Use babel-plugin-transform-react-remove-prop-types to
slim down the production build
This commit is contained in:
Risha Mars 2019-01-04 16:05:48 -05:00 committed by GitHub
parent a397393996
commit 884ae67314
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 6 deletions

View File

@ -1,5 +1,8 @@
{
"presets": [
"env", "react-app"
]
"env": {
"production": {
"plugins": ["transform-react-remove-prop-types"]
}
},
"presets": ["react-app"]
}

View File

@ -1,6 +1,6 @@
import 'whatwg-fetch';
import { attr, call, select, selectAll } from 'd3-selection';
import { forceCenter, forceLink, forceManyBody, forceSimulation } from 'd3-force';
import { select, selectAll } from 'd3-selection';
import PropTypes from 'prop-types';
import React from 'react';
import _get from 'lodash/get';
@ -17,8 +17,6 @@ import withREST from './util/withREST.jsx';
const d3 = Object.assign(
{},
{
attr,
call,
drag,
forceCenter,
forceLink,

View File

@ -29,6 +29,7 @@
"babel-jest": "23.6.0",
"babel-loader": "7.1.4",
"babel-plugin-import": "1.7.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.21",
"babel-preset-env": "1.7.0",
"babel-preset-react-app": "3.1.1",
"babel-runtime": "^6.26.0",

View File

@ -1333,6 +1333,11 @@ babel-plugin-transform-react-jsx@6.24.1, babel-plugin-transform-react-jsx@^6.24.
babel-plugin-syntax-jsx "^6.8.0"
babel-runtime "^6.22.0"
babel-plugin-transform-react-remove-prop-types@^0.4.21:
version "0.4.21"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.21.tgz#0087938f4348cb751b3e5055a6b38f3c61b5231b"
integrity sha512-+gQBtcnEhYFbMPFGr8YL7SHD4BpHifFDGEc+ES0+1iDwC9psist2+eumcLoHjBMumL7N/HI/G64XR5aQC8Nr5Q==
babel-plugin-transform-regenerator@6.26.0, babel-plugin-transform-regenerator@^6.22.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz#e0703696fbde27f0a3efcacf8b4dca2f7b3a8f2f"