Skip to main content

Overview

Running ng build compiles the Angular application, runs the TypeScript compiler, bundles all modules, and writes the output to the dist/ directory. The build process is configured in angular.json and varies depending on the target configuration.

Build commands

ng build
Always use --configuration production when building for a production deployment. Omitting this flag produces a development build that is unminified, includes source maps, and skips ahead-of-time (AOT) compilation — it is not suitable for production.

Development vs. production builds

Running ng build without a configuration flag uses the default development settings:
  • No minification — output is readable for debugging
  • Source maps included
  • JIT (Just-in-Time) compilation
  • Faster build times
Use this for local verification of build output, not for deployment.

Build output

After a successful build, the dist/ directory contains everything needed to serve the application:
dist/
└── gems-lms-web/
    ├── index.html
    ├── main.js
    ├── styles.css
    └── assets/
        └── (images, fonts, static files)
FileDescription
index.htmlEntry point for the application
main.jsBundled application code (hashed filename in production)
styles.cssGlobal stylesheets (hashed filename in production)
assets/Static assets copied as-is from src/assets/
In a production build, filenames include a content hash (e.g., main.abc123.js). This enables long-term browser caching: files only change their names when their content changes, so browsers can safely cache them indefinitely.

Deployment

The contents of dist/gems-lms-web/ are a static site. Deploy them by copying the directory to any static web server or CDN:
# Example: copy to a static server directory
cp -r dist/gems-lms-web/* /var/www/html/
Because Karma LMS is an Angular SPA, configure your server to serve index.html for all routes so that client-side routing works correctly. On nginx, this is done with a try_files $uri $uri/ /index.html; directive.

Build docs developers (and LLMs) love