DEV Community

Discussion on: 5 things to include in your project ASAP

Collapse
 
polaroidkidd profile image
Daniel Einars

The module aliases can come back to haunt you though because it makes it easy to accidentally create circular dependencies. I use them aswllu but with the rule of thumb to not use aliased imports within the module. So if I'm working on a component which imports another component, I'll use the relative path for that import.

Collapse
 
lbragile profile image
Lior Bragilevsky

Great point! As long as you provide aliases to the main modules of your project (not their internals), circular dependencies should not happen. Yes, you could use relative imports within a module without any problems, but I think it leads to slower programming as you have to determine the correct relative path each time - unless your IDE handles this for you. In my case aliasing greatly increased my workflow speed - but your comment brought forward a valid point that I previously did not consider.