Skip to main content

@babel/plugin-transform-member-expression-literals

NOTE: This plugin is included in @babel/preset-env

Example

In

JavaScript
obj.foo = "isValid";

obj.const = "isKeyword";
obj["var"] = "isKeyword";

Out

JavaScript
obj.foo = "isValid";

obj["const"] = "isKeyword";
obj["var"] = "isKeyword";

Installation

npm install @babel/plugin-transform-member-expression-literals --save-dev

Usage

babel.config.json
{
"plugins": ["@babel/plugin-transform-member-expression-literals"]
}

Via CLI

Shell
babel --plugins @babel/plugin-transform-member-expression-literals script.js

Via Node API

JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-transform-member-expression-literals"],
});