Ionic App not serving correctly on web after Ionic 5 to Ionic 6 and Angular 10 to Angular 13 migration (baseHref issue?)

We have an Ionic application which we have just migrated from Ionic 5 to Ionic 6 and Angular 10 to Angular 13. The app is served on the web as well as deployed to the native Android and iOS Stores.

When we deploy to the web server the app does not load and we get errors. The problem seems to be that the baseHref setting in our angular.json file is now being ignored.

In angular.json we have one configuration for our device builds and one for our web builds. In the web build configuration we have this:

"baseHref": "/web/"

This works find when we deploy out Ionic 5 / Angular 10 web files but when we deploy the migrated app we get errors loading asset files where it tries to load from


where it should be loading from


I can’t find any documentation anywhere for Angular 11, 12 or 13 that suggests there was a breaking change for this. Does anyone know what I need to do in my angular.json file to get this to work?

Just noticed that the index.html file has

<base href="/">

in it instead of

<base href="/web/">

so the build process is definitely ignoring that setting

@mhartington sorry for tagging you but you marked my comment above as a solution but in fact it’s not - I was just confirming my point that the angular.json setting is now being ignored in Angular 13. We do our builds in AppFlow and I have two configurations - one for Device builds and one for Web builds. The Web configuration needs the build to result in a base href of “/web/” in the index.html so in the angular.json file for the web configuration I have the baseHref setting of "/web/. With Angular 10 our AppFlow builds work and the index.html generated correctly has the “/web/” in it but in Angular 13 they only have “/” in i.e the baseHref setting is now being ignored Do you know how I can get round this on AppFlow rather than manually editing my index.html file afterwards? If I was building locally I think I could specify the href in the build command just for the web builds but on Appflow I don’t have that option (as far as I’m aware?) I’m guessing in Angular 13 I need to specify things differently but I can’t find details anywhere?

So I just tested this out with a new starter project to validate it first.

<!-- src/index.html -->
  <meta charset="utf-8" />
  <title>Ionic App</title>

  <base href="/" />

Added the following to my angular.json’s build options

      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "www",
            "baseHref": "/web/",

ran ng build and open the www/index.html.

<!-- www/index.html -->
  <meta charset="utf-8"/>
  <title>Ionic App</title>

  <base href="/web/"/>

I also checked with the angular folks and they said that the CLI should be updating the baseHref

So you might need to review your @angular-devkit/build-angular to make sure you have the latest release. Since app flow is just running a normal build, you should be able to replicate this locally.