Running mutiple angular2 applications #1131

Closed
opened 2025-08-09 17:18:59 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @tmedanovic on 1/9/2017

What is proper way to run multiple angular2 applications using boot-server and boot client style?

I managed to get it half-working by duplicating existing app configuraration like this:

ClientApp/
admin/
admin.module.ts
app/
app.module.ts
dist/
vendor-manifest.json
vendor-admin-manifest.json
vendor.js
vendoradmin.js

boot-client.ts
boot-server.ts
boot-admin-client.ts
boot-admin-server.ts

After that I added Admin controller and Admin view with something like:

@{
    ViewData["Title"] = "Home Page";
}

<app asp-prerender-module="ClientApp/dist/main-admin-server">Loading...</app>

<script src="~/dist/vendoadmin.js" asp-append-version="true"></script>
@section scripts {
    <script src="~/dist/main-admin-client.js" asp-append-version="true"></script>
}

But then HMR worked only when I started first app, after going to second app /admin HMR went wild and started searching for non existing hot module update file, after returning to first app (/) I would get:

Prerendering failed because of error: Error: Zone already loaded.

Am I going in the right direction with this? I don't have much experience with webpack and prerendering, any tips or examples are welcome.

*Originally created by @tmedanovic on 1/9/2017* What is proper way to run multiple angular2 applications using boot-server and boot client style? I managed to get it half-working by duplicating existing app configuraration like this: ClientApp/ admin/ admin.module.ts app/ app.module.ts dist/ vendor-manifest.json vendor-admin-manifest.json vendor.js vendoradmin.js boot-client.ts boot-server.ts boot-admin-client.ts boot-admin-server.ts After that I added Admin controller and Admin view with something like: ``` @{ ViewData["Title"] = "Home Page"; } <app asp-prerender-module="ClientApp/dist/main-admin-server">Loading...</app> <script src="~/dist/vendoadmin.js" asp-append-version="true"></script> @section scripts { <script src="~/dist/main-admin-client.js" asp-append-version="true"></script> } ``` But then HMR worked only when I started first app, after going to second app /admin HMR went wild and started searching for non existing hot module update file, after returning to first app (/) I would get: > Prerendering failed because of error: Error: Zone already loaded. Am I going in the right direction with this? I don't have much experience with webpack and prerendering, any tips or examples are welcome.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1131
No description provided.