File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 27
27
* @since 0.1.0
28
28
*/
29
29
const onCreateBabelConfig = ( { actions } ) => {
30
+ const r = m => require . resolve ( m ) ;
31
+
30
32
/*
31
33
* Allows to use the "ES Class Fields & Static Properties" proposal to transforms static class properties as well as
32
34
* properties declared with the experimental property initializer syntax.
@@ -80,6 +82,30 @@ const onCreateBabelConfig = ({ actions }) => {
80
82
loose : false
81
83
}
82
84
} ) ;
85
+
86
+ /*
87
+ * Removes unnecessary React `propTypes` from production builds.
88
+ *
89
+ * @see https://github.com/oliviertassinari/babel-plugin-transform-react-remove-prop-types
90
+ */
91
+ actions . setBabelOptions ( {
92
+ options : { } ,
93
+ config : {
94
+ env : {
95
+ production : {
96
+ plugins : [
97
+ [
98
+ r ( "babel-plugin-transform-react-remove-prop-types" ) ,
99
+ {
100
+ removeImport : true ,
101
+ ignoreFilenames : [ "node_modules" ]
102
+ }
103
+ ]
104
+ ]
105
+ }
106
+ }
107
+ }
108
+ } ) ;
83
109
} ;
84
110
85
111
module . exports = onCreateBabelConfig ;
You can’t perform that action at this time.
0 commit comments