I understood everything ... having picked it up in internates, I realized that this can only be done with the SystemJS collector, here is the link, although people also complain about a similar error ( https://blog.sstorie.com/bootstrapping-multiple-angular-2- applications-on-the-same-page / ).
If you use angular-cli, then there is added only the ability to separately create two applications, but do not run and build at the same time ( https://github.com/angular/angular-angular/cli/wiki/stories-multiple-apps ).
So you need to vote for this feature ( https://github.com/angular/angular/angular-cli/issues/6428 )
.angular-cli.json
"apps": [ { "name":"app1", "root": "src", "outDir": "dist", "assets": [ "assets", "favicon.ico" ], "index": "index.html", "main": "main-one.ts", "polyfills": "polyfills.ts", "test": "test.ts", "tsconfig": "tsconfig.app.json", "testTsconfig": "tsconfig.spec.json", "prefix": "app", "styles": [ "styles.css", "../node_modules/@angular/material/core/theming/prebuilt/indigo-pink.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": "main-two.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" } } ],
structure:
src/ ---/app1 ---/app2
start
ng serve --app app1 ng serve --app app2