Have a single NGINX, serving 3 applications. So to differentiate we have added base href in package.json as below and updated index.html of each application to reflect base href
Package.json
"csr:build:client:dev1": "node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build --base-href /adminui/ --deploy-url /adminui/ --output-path=dist/DEV/public --aot=true",
And in index.html
<base href="/adminui">
Similar updates were made on other 2 apps. But I got below errors on browser console and page never loaded
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
polyfills.js:1
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
vendor.js:1
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
main.js:1
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
runtime.js:1
Apps were running fine, if individually launched with no base href or using default.
Below are the changes I tried, along with above changes.
tsconfig.base.json
"target": "es2015",
to
"target": "es5",
Added in app.module.ts and app.server.module.ts
import { APP_BASE_HREF} from '@angular/common';
providers: [
{provide: APP_BASE_HREF, useValue: '/adminui'}
]
But none worked, the same error.