"apps": [
{
"name": "app1",
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
},
{
"name": "app2",
"root": "src",
"outDir": "dist2",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main2.ts",
"polyfills": "polyfills2.ts",
"test": "test2.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app2",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
我能够通过以下命令使这个运行起来:
ng serve --app 0
ng serve --app 1
我对这种方法的第一个问题是,如果我们在 angular-cli 中列出多个应用程序,如何维护它? 监控和跟踪会变得有些棘手。
此外,使用这种方法,您是否最好在每个main.ts文件中引导不同的模块?
我看到的第二种方法是在注释中的一个示例中。
https://github.com/Farata/angular2typescript/blob/master/Angular4/router-samples/.angular-cli.json。
这更理想,尽管我无法复制并确定所有这些应用程序除名称外如何共享相同的dist文件夹和其他内容。
通过共享所有内容的第二种方法,我想知道这与创建大量模块并延迟加载它们有何不同?
我知道这个问题非常基于理论,但在线资源非常有限,我很想知道其他开发人员如何解决这个问题。