It replace string you choosed during babel runtime
-
yarn add babel-plugin-search-and-replace -DE
ornpm i babel-plugin-search-and-replace --save-dev --exact
-
Add the following lines in your .babelrc
{
"plugins": [
[
"search-and-replace",
{
"rules": [
{
"search": "searchedString",
"replace": "replacement"
},
{
"search": /myRegex/,
"replace": "replacement"
}
]
}
]
]
}
For Babel < 7 use babel-plugin-search-and-replace@0.3.0
{
"plugins": [
[
"search-and-replace",
[
{
"search": "searchedString",
"replace": "replacement"
},
{
"search": /myRegex/,
"replace": "replacement"
}
]
]
]
}
-
Enjoy
-
And, that's all
-
Really that's all ;)