You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I haven't had a use case for that structure yet but I could see that being pretty useful if you were trying to really break up your code. I see your motivation to reduce the amount of boilerplate index.js files all over your lib sub folders, but I worry about the implications of making lib/index.js always require sub folders. Again, I don't know your real-world use case and you may be perfectly fine with doing the recursive requires with every file that wants something in lib. I think a more flexible solution being something like:
Have an index.js at the root of every sub folder that describes how to require it's sibling files. This would allow for greater control at any level, but require a bit more boilerplate. The biggest advantage I see is that you would be able to require at any level of your lib depending on the need of the calling file. For example you could just get the sub-package you want, without having to require alllll of lib (and making it do all the other requires), just to grab b2. It would allow for pretty much any usage that a caller might want.
That's just my initial thoughts on implementing a "folder" feature (since this currently just ignores folders). I don't feel especially strong either way, so let me know what you think.
Hi!
I think it would be great to handle recursivity.
Given the following structure:
We could then do something like this:
And it would avoid to have to create an index.js in each sub directory.
What do you think ? :)
The text was updated successfully, but these errors were encountered: