I suggest you use NX for this, it is easy to clean up for exchanging code between applications
Now you can create a multiplr application inside this workspace, it can be Angular or React App, or a combination of both.
ng add @nrwl/angular --defaults ng g @nrwl/angular:application app1 // generate first app ng g @nrwl/angular:application app2 //generate second app
they are visible in the application directory

so now you have your own applications, you can exchange code between applications by creating libraries
ng g @nrwl/angular:lib ui // ui is the name of your library
now available in the libs directory

Now you can work with your library, generating components and services:
ng g component sharedComponent --project=ui --export
Finally, you can use your library in your applications (app1 and app2) by importing your UiModule
import { UiModule } from '@MY_WORK_SPACE/ui'; // @nameOfYourCreatedWorkspace/nameOfLibrary @NgModule({ declarations: [AppComponent], imports: [BrowserModule, HttpClientModule, UiModule], // import here providers: [], bootstrap: [AppComponent] }) export class AppModule {}
and voila!
Fath mohamed
source share