To import component outside src/ directory with React, we can declare a local dependency on package.json.
For instance, we write
{
//...
"dependencies": {
"app-b-dashboard": "file:./packages/app-b-dashboard"
//...
}
//...
}
to declare the app-b-dashboard
dependency in the dependencies
section of package.json.
Then we run
npm install
to install the dependencies.
And then we add
import Dashboard from 'app-b-dashboard/container'
to import the app-b-dashboard
dependency which is installed in node_modules.