Skip to content →

Deploy Ionic PWA to a sub-path

I often don’t bother about deploying temporary apps on their own realm like host. e.g. newapp.brayan.com. I rather chose to deploy them to a sub-path. e.g. www.brayan.com/newapp.

If you’re main site is already set up, it does NOT require any cumbersome URL rewriting. Work with the base-url and have Angular, not Ionic, adapt the references to javascripts and other web resources.

The only drawback that comes along is that Ionic CLI  has NOT implemented the argument –base-href so far.  Anyhow, you are not missing anything if you are invoking the ng build instead.

ng build --prod --base-href=/newapp/

The only scenario, I could think of, where that could hamper your deployment process, is when you develop with Ionic without using Angular. That is with Stencil (without Angular) for example.

Published in DevOps

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *