Reputation: 247
I'm relatively new to monrepo's/yarn workspaces/lerna. I was working on a React / TypeScript monorepo where I cleaned up circular dependencies. I just think they shouldn't exist in a clean code architecture. I know that they make life easier when you want to refactor parts of an app, study the app's architecture or just want to reference one of the repo's in another project.
But can someone provide a good example of where a circular dependency is actually causing an error in a TypeScript/React project? Probably related to importing Types in a circular way, or somewhere else?
Many thanks in advance!
Achim
Upvotes: 0
Views: 1762
Reputation: 1292
We had several circular dependencies in our project, which were related to the differences in bundlers (babel
for react
& metro
for react-native
).
But can someone provide a good example of where a circular dependency is actually causing an error in a TypeScript/React project?
Sure, consider the following:
import
ed in module Bimport
ed in module Cimport
s module AThis way the modules dependencies can not be resolved, at least not correctly.
I just think they shouldn't exist in a clean code architecture.
That is for sure true :) Keep it up!
Upvotes: 1