replace-identifiers
npm install babel-plugin-replace-identifiersreplace-identifiers
It replace an Identifier to another Identifier.
If you want to replace an Identifier to a string literal(LVal), you can see this: babel-plugin-inline-replace-variables
.babelrc
``json`
{
"plugins": [
["replace-identifiers", {
"React": "Rx"
}]
]
}
In
`js`
React.createElement('foo', bar, 'React', React);
Out
`js`
Rx.createElement('foo', bar, 'React', Rx);
`sh`
$ npm install babel-plugin-replace-identifiers
.babelrc
`json`
{
"plugins": [["replace-identifiers", {
"foo": "bar",
"hello": "world"
}]]
}
`sh`
$ babel --plugins replace-identifiers script.js
`javascript``
require("babel-core").transform("code", {
plugins: ["replace-identifiers"]
});