When there is a variable declaration inside the function body, which shares its name to a referenced identifier in default parameter expression, the function body should be wrapped into iife, otherwise the binding in default parameter scope will be shadowed by function body.
@babel/plugin-transform-parameters
Compile ES2015 default and rest parameters to ES5
See our website @babel/plugin-transform-parameters for more information.
Install
Using npm:
npm install --save-dev @babel/plugin-transform-parameters
or using yarn:
yarn add @babel/plugin-transform-parameters --dev