跳到主要内容

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

信息

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"],
});