Subdirectory for ionic build browser


#1

Hey there,
currently i got an ionic 3 app, built for ios, android and want to publish it as a regular webapp for the browsers.
The issue is that the published app works locally only. On the server it has to be in a subdirectory.

I use

ionic build --prod

and push the content of ‘myapp/www’ to the server

So https://mywebsite.com/~myapp is the url to call the webapp.

As i googled base-html property doesn’t work here like it does for a regular Angular-app and i don’t get a convenient solution to add a /myapp to my assets and my pages.

Do i have to setup every single service and page to ‘/myapp’ via
let deepLinkConfig: DeepLinkConfig = { links: [ { component: ProfilesPage, name: 'Steckbriefe', segment: '~myapp'} ] }
and adjust any single path of an included image in the assets-folder?

Is the ionic-deeplinks-plugin the proper way to config such a simple task?

Just in case my ionic-info:

@ionic/cli-utils  : 1.12.0
    ionic (Ionic CLI) : 3.12.0

global packages:

    cordova (Cordova CLI) : 7.0.1

local packages:

    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : browser 4.1.0
    Ionic Framework    : ionic-angular 3.6.1

System:

    Node : v8.4.0
    npm  : 5.3.0
    OS   : Windows 10

Misc:

    backend : pro

Thank you very much


#2

How exactly are you building your app?
What happens when you upload your app to the subdirectory - doesn’t it work?


#3

I build the app using

ionic build --prod 

and use the content of ‘myapp/www’ and push it to the server.

It doesn’t work, since it can’t find the pages,services and the images.


#4

How exactly is it working locally? How are you building and testing there?
What are the errors in the browser dev tools console or network panel when it does not work?
Does it work if you build with ionic build and upload that?


#5

Yes, it works properly with
ionic build
Thank you very much, but why is that?

Whats different to adding the “–prod” option?


#6

--prod triggers a production buidl that does some optimizations for a smaller and faster app.

Can you post the whole output of both commands, with and without --prod please?