babel-plugin-react-remove-properties
Babel plugin for removing React properties.
Installation
npm install --save-dev babel-plugin-react-remove-propertiesThe problem solved
This is useful when using selectors like data-test to run selenium test. Those properties are useless when running the code in production. You can save bandwidth by removing them.
Example
In
Component { return <div className="bar" data-test="thisIsASelectorForSelenium"> Hello Wold! </div> ; }Out
Component { return <div className="bar"> Hello Wold! </div> ; }Usage
Via .babelrc (Recommended)
.babelrc
without options:
with options. We accepts an array of property names that can be either strings or regular expressions:
Via CLI
babel --plugins react-remove-properties script.jsVia Node API
without options:
;with options:
;License
MIT