Deep links prevent android apk from loading any javascript files

Hi all,

First my Ionic info:
Your system information:

Cordova CLI: 6.5.0
Ionic Framework Version: 2.2.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v6.9.4
Xcode version: Not installed

I’ve recently added deep links using DeepLinker:
http://ionicframework.com/docs/v2/api/navigation/DeepLinker/
This works as expected when testing in my laptop browser using ‘ionic serve’, but completely breaks my android app giving me the dreaded white screen of death because no javascript files can be found and loaded from my index.html file. Maybe I have configured something wrong but I can’t find a way to get this working with deep links on a actual android device.

Screenshot from connecting my android phone to my laptop and using chrome debug tools to connect to it (chrome://inspect/#devices) showing all 4 very important javascript files can’t be found:

The debugger shows my index.html file is located at:
file:///android_asset/www/index.html

The paths to each of these files according to the javascript debugger are:
file:///cordova.js
file:///build/main.css
file:///build/main.js
file:///build/polyfills.js

It works as expected on my device if I disable deep links by commenting out the “base href” in index.html:

<base href="/">

and commenting out the deep link definitions in IonicModule.forRoot in app.module.ts

IonicModule.forRoot(MarineiacApp,
    {
      //locationStrategy: 'path'
    },
    {
      // links: [
      //   ...,
      //   ...,
      //   ...
    }

Of course disabling deep links for mobile apps is not ideal since I would like to use the same exact code base for desktop and mobile.

The question is… why is ‘ionic build’ to create my android apk breaking the location of the javascript files when using deep links? Am I configuring my “base href” in index.html wrong? Is this a bug?

Thanks,
Erik

Figured it out… wish the DeepLinker docs were better and mentioned this very important detail!

You have to specify the “base href” using APP_BASE_HREF in the providers section in app.module.ts:

import { APP_BASE_HREF } from '@angular/common';

  providers: [
    FavoritesData, SearchData, UserData,
    {provide: APP_BASE_HREF, useValue : '/' }
  ]