@@ -17,7 +17,6 @@ npm install --save-dev babel-plugin-transform-react-remove-prop-types
1717
1818## The problem solved
1919
20-
2120Remove React ` propTypes ` from the production build, as they are only used in development.
2221You can ** save bandwidth** by removing them.
2322
@@ -109,6 +108,7 @@ require('babel-core').transform('code', {
109108## Options
110109
111110### ` mode `
111+
112112 - ` remove ` (default):
113113the ` propTypes ` definitions are removed from the source code.
114114 - ` wrap ` :
@@ -122,12 +122,19 @@ if (process.env.NODE_ENV !== "production") {
122122The ` wrap ` mode is targeting react libraries like [ material-ui] ( https://github.com/callemall/material-ui ) .
123123It's not intended to be used in userland.
124124
125+ ### ` removeImport `
126+
127+ - ` true ` : the import statements are removed as well. This option only works if ` mode ` is set to ` remove ` :
128+ ``` js
129+ import PropTypes from ' prop-types'
130+ ```
131+ - ` false ` (default): does not remove the import statements.
125132
126133### ` ignoreFilenames `
127134
128135This filter generates a regular expression.
129136Any filenames containing one of the array's strings will be ignored.
130- By default, we match everything.
137+ By ** default** , we match everything.
131138
132139Following the [ Is it safe?] ( #user-content-is-it-safe ) section, you might encounter a component
133140depending on the ` propTypes ` at runtime to work.
@@ -137,14 +144,6 @@ For instance, you can ignore all the npm modules:
137144ignoreFilenames: [' node_modules' ],
138145```
139146
140- ### ` removeImport `
141- - ` true `
142- This removes the ` import PropTypes from 'proptypes' ` as well.
143- This option only works if ` mode ` is set to ` remove `
144- - ` false ` (default):
145- Does not remove any import statements.
146-
147-
148147## Is it safe?
149148
150149If you are using the ` propTypes ` in a conventionnal way,
0 commit comments