About design and nearby

How to bundle an Angular app for production to non-root path

Posted: March 14th, 2018 | Author: | Filed under: Development, Tips and Tricks | Tags: , , , , , | No Comments »

Bundling steps are pretty easy.. till you do it yourself for the first time :)

1. Start with the development build:

ng build ––prod

2. By default files will be placed in the ‘dist’folder of your angular project:

angular files

Copy them to a folder on the server.

3. In cause you place the files into a server sub-folder, append the build flag, –base-href and set the correct ‹base href›:

ng build ––prod ––base-href /mobile/

bundle an Angular app for production to non-root path

This way the index.html is placed on the server at /mobile/index.html and the base href is
‹base href=”/mobile/”›.

4. Be sure your server is configured to redirect requests to index.html.

You are done!

Share Button

Check Related Posts:


Leave a Reply


  • 3 − = one

Looking for a Freelance UX & UI designer for your project? I’m ready to jump onboard!

Let's discuss your project now