I have a 2 projects which requires each others.
The root-app is run by node. It imports child-app/index.js.
The child-app has a dependency on root-app as well. It needs to import Component.js from it. child-app is never run independently of root-app, it is always imported by the root-app.
root-app:
/Component.js
/index.js
/package.json
child-app:
/index.js
/package.json
So basically the root-app requires the child-app and the child-app requires a component from the root-app.
root-app/index.js:
import ChildApp from 'child-app';
child-app/index.js
import Component from 'root-app/Component';
At the moment, my package.json files look like this:
root-app/package.json
{
"name": "root-app",
"dependencies": {
"child-app": "file:../child-app"
}
}
child-app/package.json
{
"name": "child-app",
"peerDependencies": {
"root-app": "file:../root-app"
}
}
This of course doesn't work and I get an error:
Unable to resolve module 'root-app' from 'root-app/node_modules/child-app/index.js'
So my question, is there any way to have this kind of dependencies working without the need of creating a third project that will work as a "bridge" between those two projects?
Thanks!