Closed tleunen closed 7 years ago
Hi @tleunen!
Are you up for creating a PR?
Sure! Will do later today.
Is it possible to test with a dummy local project instead of a node_modules project?
Because there a some edge cases, like it should use the directory name only if there's no file having the same name as its directory. And if it's the case, we can skip the index pair.
As an example, we should save the pair with the index in this case: https://github.com/callemall/material-ui/tree/master/src/DropDownMenu Othwerwise we'll end up with the wrong file
Sure. Mock it up.
Adding support for directories would be great, as it is one of the reasons why babel-plugin-lodash
is not able to make its magic with date-fns
I've decided to give this a go in #175. I've added tests for both material-ui
and date-fns
and it seems to work well (tested also on a private project).
With this change this plugin is even more generic!
Moved to #175.
Currently, if a project is structured using directories in which
index.js
is used, the pairs in the configuration will be[ 'index', 'index' ]
which won't produce the right thing.See https://github.com/lodash/babel-plugin-lodash/blob/master/src/ModuleCache.js#L31-L34
When
index.js
is used, it should be the directory name instead of the file name.