I am breaking my project into different repos. I have 3 different repos: base, utils and my project.
Base contains: CustomText
Utils contains: Wrapper & StyleHelper
My project contains: the app I'm working with.
The error occurs when I import Wrapper in my project like so:
import { Wrapper } from 'utils';
in Wrapper.js I import a CustomText Component
import { CustomText } from 'base';
in CustomText.js I import a StyleHelper
import { StyleHelper } from 'utils';
The error I get refers to the StyleHelper. The error says "cannot read 'create' of undefined" - create is a method on the StyleHelper component. So when I import Wrapper in my project StyleHelper is undefined. When I don't import Wrapper in my project StyleHelper is defined and no error occurs.
If they are not in separate repos the app works. Also, if I remove the CustomText import in Wrapper it works.
How do I get these to work if I want to break up the project into different repos? I'd assume some sort of circular dependency, but why is this happening? If it is some sort of circular dependency, what's the best practice to avoid this when breaking up a large project into many repos?