What is the best practice to share code between angular 2 projects? How can I share components between projects?
Below dashboard example should be use components of the eye project, and nose project.
In this case, using this seed link . I run three commands below to see all applications, but I need to copy source and eye source to dashboard project to share componets
npm run serve.dev -- --client eye
npm run serve.dev -- --client nose
npm run serve.dev -- --client dashboard
I miss the hot reload, because if you modify eye.component or nose.component you need to copy this components to dashboard project
src
├── eye
│ ├── app
│ │ ├── components
│ │ │ ├── eye.component.html
│ │ │ ├── eye.component.ts
│ │ │ ├── eye.component.css
├── nose
│ ├── app
│ │ ├── components
│ │ │ ├── nose.component.html
│ │ │ ├── nose.component.ts
│ │ │ ├── nose.component.css
├── dashboard
│ ├── app
│ │ ├── components
│ │ │ ├── dashboard.component.html
│ │ │ ├── dashboard.component.ts
│ │ │ ├── dashboard.component.css
Other example, to ilustrate
In the structure below, commonapplication need to share eye.component and nose.component with bodyaplication and dashboardaplication.
src
├── commonaplication
│ ├── app
│ │ ├── components
│ │ │ ├── eye.component.ts
│ │ │ ├── nose.component.ts
├── bodyaplication
│ ├── app
│ │ ├── components
│ │ │ ├── head.component.ts
├── dashboardaplication
│ ├── app
│ │ ├── components
│ │ │ ├── dashboard.component.ts