Repository navigation
Remove remaining lodash dependencies - #13139
Conversation
| @@ -1,4 +1,4 @@ | |||
| import last from "lodash/last" | |||
| import last from "lo-dash/last" | |||
There was a problem hiding this comment.
This is just an input/output fixture, but it was annoying when grepping for lodash 馃槀
There was a problem hiding this comment.
lol we want to ctrl+f and find no results
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit dc0b4bd:
|
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/45155/ |
| // to ignore the log message rather than making @babel/cli crash. | ||
| return; | ||
| } | ||
| const logSuccess = util.debounce(function () { |
There was a problem hiding this comment.
oh great! I wasn't sure about replacing in the earlier PR because of the trailing: true and also logSuccess.flush(); on line 173, but looks like it covers it!
| { | ||
| sourceRoot: path.dirname(filename) + path.sep, | ||
| ...deepClone(transformOpts), | ||
| ...cloneDeep(transformOpts), |
There was a problem hiding this comment.
And the reason we probably want to keep this is because transformOpts might have like things like functions vs. just objects given how people configure @babel/register with js?
There was a problem hiding this comment.
Yeah, also people can pass any JS value as plugin options.
| "devDependencies": { | ||
| "eslint": "^7.5.0", | ||
| "lodash": "^4.17.20" | ||
| "clone-deep": "^4.0.1", |
There was a problem hiding this comment.
clone-deep is quite bloated package. Maybe try klona?
There was a problem hiding this comment.
My strategy for choosing the clone-deep package was "Ctrl+F for clone in our yarn.lock file", so thanks for suggesting an alternative 馃槀
There was a problem hiding this comment.
Oh it looks like klona requires Node.js >= 8, so until the Babel 8 release we cannot use it.
|
@nicolo-ribaudo Nice :) Does this mean that |
|
The base |
We were only using a very small number of functions from lodash, so we can avoid depending on it.
This PR still uses an external
clone-deepimplementation, but it has 10M weekly downloads (so it's battle-tested) and it's about 60% smaller thanlodash/cloneDeep.