I have a build setup that works fine using ng build, but I can't get the same to work with ng serve.
I have two Angular applications using the same .angular-cli.json but being deployed to two different folders. It looks something like this:
"apps": [
{
"name": "app1",
"root": "Client",
"outDir": "wwwroot/app1",
"index": "index-app1.html",
"main": "app1.ts",
"tsconfig": "tsconfig.app1.json",
"prefix": "app1"
},
{
"name": "app2",
"root": "Client",
"outDir": "wwwroot/app2",
"index": "index-app2.html",
"main": "app2.ts",
"tsconfig": "tsconfig.app2.json",
"prefix": "app2",
}
],
I can run ng build --app=app1 or ng build --app=app2 and they are built into wwwroot/app1 and wwwroot/app2. I can then access the apps under http://localhost:4000/app1 and http://localhost:4000/app2.
But in my development environment I'd like to be able to use ng serve (for live reloading). The problem is that ng serve --app=app1 will create the js files directly under wwwroot (in a virtual directory), but index-app1.html look for them under http://localhost/app1/main.bundle.js for example.
I've tried to use different combination of --base-ref and --output-path but with no luck.
Does anyone know how to fix this?
I never managed to find a better solution than running one app at a time using ng serve --base-href=/.