Deployment is the process of preparing an application to run and operate in a specific environment. In Angular 21, the production build command is simply ng build - production mode is the default and the --prod flag is no longer needed. Once ready for deployment to a remote server, there are many options available, such as:-
There are a few simple steps for simple deployment, which include the following:-
Step 1:- First create the production build. In Angular 21, just navigate to the project folder and run the below command in terminal - production mode is the default.
Step 2:- Copy all the content from the output folder i.e. dist folder (by default) to a folder on the server.
Step 3:- Now, just configure the web server to redirect missing files requests to index.html.
# Angular 21 - production is the default, no --prod flag needed
ng build
There are few simple steps to deploy on GitHub pages, such as:-
Step 1:- First, create a GitHub account if you don't have one, and then create a repository for your project.
Step 2:- Now, build project using Github project repository name, just navigate to project folder and run below command in terminal.
Step 3:- Once the build is complete, make a copy of docs/index.html and rename it docs/404.html.
Step 4:- Now commit changes and push.
Step 5:- Now, on the GitHub project page, configure it to publish from the docs folder.
We can see our deployed page at https://.github.io//.
# Build for GitHub Pages (replace <project_name> with your repo name)
ng build --output-path docs --base-href /<project_name>/
In Angular 21, the production build command is simply ng build - production mode is the default. The --prod flag is no longer needed. Additional deployment options include:
Explore 500+ free tutorials across 20+ languages and frameworks.