@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
- Yarn
- pnpm
npm install @babel/plugin-transform-member-expression-literals --save-dev
yarn add @babel/plugin-transform-member-expression-literals --dev
pnpm add @babel/plugin-transform-member-expression-literals --save-dev
Usage
With a configuration file (Recommended)
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"],
});