Babel
  • Docs
  • Setup
  • Try it out
  • Videos
  • Blog
  • Donate
  • Team
  • GitHub
Edit

@babel/plugin-transform-reserved-words

Some words were reserved in ES3 as potential future keywords but were not reserved in ES5 and later. This plugin, to be used when targeting ES3 environments, renames variables from that set of words.

Example

In

var abstract = 1;
var x = abstract + 1;

Out

var _abstract = 1;
var x = _abstract + 1;

Installation

npm install --save-dev @babel/plugin-transform-reserved-words

Usage

With a configuration file (Recommended)

{
  "plugins": ["@babel/plugin-transform-reserved-words"]
}

Via CLI

babel --plugins @babel/plugin-transform-reserved-words script.js

Via Node API

require("@babel/core").transformSync("code", {
  plugins: ["@babel/plugin-transform-reserved-words"]
});

References

  • ES3 Spec: Future Reserved Words
  • Example
  • Installation
  • Usage
    • With a configuration file (Recommended)
    • Via CLI
    • Via Node API
  • References
Babel
Docs
Learn ES2015
Community
VideosUser ShowcaseStack OverflowSlack ChannelTwitter
More
BlogGitHub OrgGitHub RepoWebsite RepoOld 6.x SiteOld 5.x Site