-
Couldn't load subscription status.
- Fork 1.4k
Multiple Applications
Angular Seed supports multiple applications with shared codebase! The default application which by default goes with the seed resides in src/client/app. For another application, called "todo", which uses the code from "app" use:
- Create a directory called "todo" in
src/client. - In "todo" directly reference files located in "app". For instance, in order to use the shared module use:
// src/client/todo/app.module.ts
import { NgModule } from '@angular/core';
import { SharedModule } from '../app/shared/shared.module';
@NgModule({
imports: [SharedModules.forRoot()],
// ...
})- In order to start your application in development mode use:
npm start -- --app todo- In order to build your application for production:
# AoT disabled
npm run build.prod -- --app todo
# AoT enabled
npm run build.prod.exp -- --app todoFor the production build, ONLY the used by the app "todo" files will be included in the app.js bundle.
Note: If you have to override SystemJS Builder's config in project.config.ts make sure that you declare paths for each project (for more information take a look at tools/config/seed.config.ts).
If you're getting 404 error for shared modules make sure that you have all your shared projects in seed.config.ts like so:
packages: {
[this.BOOTSTRAP_DIR]: {
defaultExtension: 'js'
},
'app': {
defaultExtension: 'js'
},
'sharedCommons': {
defaultExtension: 'js'
},
'oneMoreSharedProject': {
defaultExtension: 'js'
}
}