babel-upgrade
babel-upgrade copied to clipboard
Add babel-plugin-lodash if in dependencies
https://twitter.com/kentcdodds/status/976808822307094528
Should be easy to do. Detect if lodash is used as a direct dependency and then add a new plugin? Not sure about the version or if we need to use the "latest version" package on npm to do that.
a cursory idea at what might be involved, in case any first-time contributor needs some direction:
- in updateDeps.js, check for
dependencies['lodash']
(referenceflow
,babel-loader
portions for potentially similar logic) - add
babel-plugin-lodash
to deps with appropriate version- version determination might be the most complex part of this -- perhaps we need to use the npm registry api?
- update tests to make sure regressions in this functionality will be caught!
Looks like there was a similar issue open on the create-react-app project about a year ago.
Use of the _.chain API (supported in all current versions of lodash) breaks babel-plugin-lodash.
The good news is that chain is soon-to-be-deprecated with the release of lodash v.5.0.0 sometime this year.
It isn't clear how many projects would be affected by this, but maybe it is best to provide a warning or simply wait until chain is officially deprecated before moving forward?
bummer. nice find though!
looks like some process has been made towards supporting this? https://github.com/lodash/babel-plugin-lodash/pull/176 -- sounds like it's not completely supported still
I'd vote towards holding off on this until it can be done safely for anyone using lodash. perhaps, as a compromise, we could detect if the user depends on lodash and is not using babel-plugin-lodash, and then log a suggestion to add it?
@kedromelon Nah the maintainer of lodash decided to revert that for some unknown reason https://github.com/lodash/babel-plugin-lodash/issues/210 https://github.com/lodash/babel-plugin-lodash/issues/219