Replace Object.assign with an inline helper
If you are authoring an application, rather than a library, it is recommended that you use the Object.assign
polyfill instead.
In
Object.assign(a, b);
Out
var _extends = ...; _extends(a, b);
Will only work with code of the form Object.assign
or Object['assign']
. The following patterns are not supported:
var { assign } = Object; var assign = Object.assign;
npm install --save-dev babel-plugin-transform-object-assign
.babelrc
(Recommended).babelrc
{ "plugins": ["transform-object-assign"] }
babel --plugins transform-object-assign script.js
require("babel-core").transform("code", { plugins: ["transform-object-assign"] });
© 2018 Sebastian McKenzie
Licensed under the MIT License.
http://babeljs.io/docs/plugins/transform-object-assign/