There's a cool feature I like about Node modules and is to create a package.json inside the main folders I have like: components, pages, interfaces, etc. with of course a JSON but only with a name property. So, it looks something like this for each folder:
{
"name": "@components"
}
And then when I need to import a component from there, I just go
import UsersTable from '@components/users-table.
I mean, that's a feature I love but I don't really use it in production because I have never seen anybody do that.
Is that a bad practice? I think it's pretty cool and makes it easier to import and refactor file structure.
Thanks.
Emmanuel Villalobos
Senior Software Developer
Tapas Adhikary
Educator @tapaScript | Founder CreoWis & ReactPlay - Writer - YouTuber - Open Source
Emmanuel Villalobos,
I(we) do. We have got few internal opensource(we call it, Inner-Source) components that we manage internally within the organization. These are UI libraries and also nodejs based back-end that are being handled this way and it is very much helping us in building things for production.