Skip to main content
Image for post: Deploy Angular apps in a shared hosting

Deploy Angular apps in a shared hosting

Some easy steps with Ng Cli

If you haven't any particular dependencies you can easily deploy your Angular app in a shared hosting using the amazing Ng Cli.
Simply run:


ng build --prod

If you haven't any error, this command will build your app and create a dist directory. In this directory, you will find result of your app with static files.
Open the index,html file and remove this line if your project will not be placed in the root directory of your hosting
The --prod option optimize the application, compile and transpile the typescript code in a more lightweight js files and assets.:


<base href="/">

Done! Just copy the files on your hosting and your index.html must be able to load the application. If you are using Firebase for example or you are reading some json file, be sure this functionality will work because some path may change when the app is online. Otherwise all must be ok. I hope this will be useful. Happy coding!

Share this post

This website and/or any sub domains use cookies to understand how you to improve your experience.