1. babel-plugin-replace-identifiers
replace-identifiers
babel-plugin-replace-identifiers
Package: babel-plugin-replace-identifiers
Created by: wssgcg1213
Last modified: Mon, 13 Jun 2022 04:03:14 GMT
Version: 0.1.1
Downloads: 5,473
Repository: https://github.com/wssgcg1213/babel-plugin-replace-identifiers

Install

npm install babel-plugin-replace-identifiers
yarn add babel-plugin-replace-identifiers

babel-plugin-replace-identifiers

replace-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

Example

.babelrc

 {
  "plugins": [
    ["replace-identifiers", {
      "React": "Rx"
    }]
  ]
}

In

 React.createElement('foo', bar, 'React', React);

Out

 Rx.createElement('foo', bar, 'React', Rx);

Installation

 $ npm install babel-plugin-replace-identifiers

Usage

Via .babelrc (Recommended)

.babelrc

 {
  "plugins": [["replace-identifiers", {
    "foo": "bar",
    "hello": "world"
  }]]
}

Via CLI

 $ babel --plugins replace-identifiers script.js

Via Node API

 require("babel-core").transform("code", {
  plugins: ["replace-identifiers"]
});

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code