@babel/plugin-transform-object-set-prototype-of-to-assign
NOTE: There are some caveats when using this plugin, see the @babel/plugin-transform-proto-to-assign
docs for more information.
Example
In
JavaScript
Object.setPrototypeOf(bar, foo);
Out
JavaScript
var _defaults = ...;
_defaults(bar, foo);
Installation
- npm
- Yarn
npm install --save-dev @babel/plugin-transform-object-set-prototype-of-to-assign
yarn add --dev @babel/plugin-transform-object-set-prototype-of-to-assign
Usage
With a configuration file (Recommended)
babel.config.json
{
"plugins": ["@babel/plugin-transform-object-set-prototype-of-to-assign"]
}
Via CLI
Shell
babel --plugins @babel/plugin-transform-object-set-prototype-of-to-assign script.js
Via Node API
JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-transform-object-set-prototype-of-to-assign"],
});