index.ts vs subComponent1.ts

./subComponent1/subComponent1.ts

25%

./subComponent1/index.ts

75%

4 votes ยท Closed

When building large scale applications, I divide my components into folders. However I the dilemma of naming the main file inside them.

Naming them index.ts allows me to require them like this

let { subModule1 } = require('./subModule/');

Which is really aesthetically pleasing and half the length, especially when you're requiring a lot of stuff.

The downside is, you end up with having multiple index.ts files to wrangle around with. At least that's that issue I'm facing.

I was wondering how to others go about this and what's their rational for their decisions.

No Comments Yet