Add babel-plugin-transform-remove-prop-types Babel plugin (https://github.com/woocommerce/woocommerce-blocks/pull/839)

* install transform-react-remove-prop-types babel plugin

* use `@wordpress/babel-preset-default` not `@wordpress/default` (name change)

* add configuration for new plugin (removing prop-types on production builds)
This commit is contained in:
Darren Ethier 2019-08-13 09:51:44 -04:00 committed by GitHub
parent e36d014584
commit 69890535c9
3 changed files with 12 additions and 1 deletions

View File

@ -6473,6 +6473,12 @@
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-react-remove-prop-types": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz",
"integrity": "sha512-eqj0hVcJUR57/Ug2zE1Yswsw4LhuqqHhD+8v120T1cl3kjg76QwtyBrdIk4WVwK+lAhBJVYCd/v+4nc4y+8JsA==",
"dev": true
},
"babel-plugin-transform-regenerator": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz",

View File

@ -56,6 +56,7 @@
"babel-plugin-transform-async-generator-functions": "6.24.1",
"babel-plugin-transform-object-rest-spread": "6.26.0",
"babel-plugin-transform-react-jsx": "6.24.1",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"babel-plugin-transform-runtime": "6.23.0",
"babel-preset-env": "1.7.0",
"bundlesize": "0.18.0",

View File

@ -105,7 +105,10 @@ const GutenbergBlocksConfig = {
use: {
loader: 'babel-loader?cacheDirectory',
options: {
presets: [ '@wordpress/default' ],
presets: [ '@wordpress/babel-preset-default' ],
plugins: [
NODE_ENV === 'production' ? require.resolve( 'babel-plugin-transform-react-remove-prop-types' ) : false,
].filter( Boolean ),
},
},
},
@ -174,6 +177,7 @@ const BlocksFrontendConfig = {
require.resolve( '@babel/plugin-transform-react-jsx' ),
require.resolve( '@babel/plugin-proposal-async-generator-functions' ),
require.resolve( '@babel/plugin-transform-runtime' ),
NODE_ENV === 'production' ? require.resolve( 'babel-plugin-transform-react-remove-prop-types' ) : false,
].filter( Boolean ),
},
},