← Back to Articles         
What files are generated in the Angular dist folder?

What files are generated in the Angular dist folder?

Published on 02 Oct 2026     8 min read Angular
Deployment

What files are generated in the Angular dist folder?

1. What is the dist folder?

The dist folder is Angular's build output directory.

When you run:

ng build

Angular compiles, bundles, and optimizes your application and places the generated deployable files inside dist.

For example:

Angular Source Code
      ↓
   ng build
      ↓
Compile + Bundle + Optimize
      ↓
    dist/
      ↓
Deploy to Web Server

You normally do not deploy your Angular source files such as .ts files. You deploy the generated build output.


2. Simple Angular application

Suppose we have:

my-app/
│
├── src/
│   ├── app/
│   │   ├── app.ts
│   │   ├── app.html
│   │   └── app.css
│   │
│   ├── main.ts
│   ├── index.html
│   └── styles.css
│
├── angular.json
├── package.json
└── tsconfig.json

Run:

ng build

Angular creates the build output under:

dist/
└── my-app/

The exact structure depends on your Angular version and rendering/build configuration. In a modern Angular application, especially with the application builder, you may see a browser directory:

dist/
└── my-app/
    └── browser/
        ├── index.html
        ├── main-XXXXXXXX.js
        ├── styles-XXXXXXXX.css
        ├── chunk-XXXXXXXX.js
        ├── favicon.ico
        └── assets/

The hash values vary from build to build.


3. Important files in dist

index.html

Example:

index.html

This is the main HTML page loaded by the browser.

The generated file references the JavaScript and CSS bundles required by the Angular application.

Conceptually:

<!doctype html>
<html>
<head>
    <link rel="stylesheet" href="styles-ABC123.css">
</head>

<body>

    <app-root></app-root>

    <script src="main-XYZ789.js"></script>

</body>
</html>

The exact generated markup can differ.

Purpose

Browser
   ↓
index.html
   ↓
Angular JavaScript bundles
   ↓
Angular application starts

4. main-XXXXXXXX.js

Example:

main-A7D9F3.js

This is one of the main JavaScript bundles produced from your Angular/TypeScript application.

For example, your source code:

bootstrapApplication(App, appConfig)
    .catch(err => console.error(err));

is compiled and bundled into browser-executable JavaScript.

You won't normally see:

app.ts
product.ts
product.service.ts

as separate TypeScript source files in the production output.

Instead, Angular's build tooling transforms and bundles the application.


5. styles-XXXXXXXX.css

Example:

styles-GH45JK.css

This contains generated/bundled global CSS required by your application.

For example:

body {
    margin: 0;
}

.container {
    width: 90%;
}

may become part of:

styles-GH45JK.css

Angular may also optimize/minify CSS during a production build.


6. chunk-XXXXXXXX.js

Modern Angular builds commonly produce JavaScript chunks.

Example:

chunk-A1B2C3.js
chunk-D4E5F6.js
chunk-G7H8I9.js

Chunks allow the application to be split into smaller JavaScript files.

This is particularly important for code splitting and lazy loading.

Suppose you have:

export const routes: Routes = [
    {
        path: 'products',
        loadComponent: () =>
            import('./products/products')
                .then(m => m.Products)
    }
];

Angular does not necessarily need to put all the Products feature code into the initial bundle.

It can create a separate chunk.

Conceptually:

Initial request

index.html
   ↓
main.js
   ↓
Application starts


User opens /products
   ↓
Products chunk downloaded
   ↓
Products component displayed

This helps reduce the amount of JavaScript required during initial application startup.


7. assets folder

If your application contains static assets, they can be copied into the build output according to the asset configuration.

For example:

public/
├── images/
│   └── logo.png
└── documents/
    └── guide.pdf

could result in files such as:

dist/
└── my-app/
    └── browser/
        ├── images/
        │   └── logo.png
        └── documents/
            └── guide.pdf

The exact location depends on your Angular configuration.

These are static files that don't need TypeScript compilation.


8. Why do generated filenames contain hashes?

You may see:

main-5JD8K2.js
styles-8HF92L.css
chunk-X82KD1.js

instead of simply:

main.js
styles.css

The hash is useful for cache busting.

Suppose a browser previously downloaded:

main-AAA111.js

You deploy a new version.

Angular may generate:

main-BBB222.js

The browser sees a different URL and downloads the new file instead of continuing to use the old cached JavaScript.

Old deployment

main-AAA111.js
       ↓
Browser Cache


New deployment

main-BBB222.js
       ↓
Different filename
       ↓
Browser downloads new version

This is especially useful for production deployments.


9. What happens to TypeScript files?

Suppose you write:

export class ProductService {

    getProducts() {
        console.log('Loading products');
    }

}

The browser cannot directly use your Angular project's TypeScript source in the normal production deployment.

During:

ng build

Angular's build pipeline processes your TypeScript and application code into optimized JavaScript bundles/chunks.

Therefore, you normally won't deploy:

product.service.ts
products.ts
app.ts

You deploy the generated JavaScript output.


10. Development vs production build

You can explicitly build using:

ng build --configuration production

For a standard Angular project, ng build commonly uses the production configuration by default, but this is controlled by the project's angular.json configuration.

Production configuration typically enables optimizations such as:

  • JavaScript/CSS optimization
  • minification
  • dead-code elimination/tree shaking
  • hashed output filenames
  • bundle optimization

So your source:

function calculateTotal() {
    // readable source code
}

may become highly optimized/minified JavaScript in the generated bundle.


11. SSR application dist folder

If your Angular application uses Server-Side Rendering (SSR), the output structure can be different.

You may see something conceptually like:

dist/
└── my-app/
    ├── browser/
    │   ├── index.html
    │   ├── main-XXXX.js
    │   ├── styles-XXXX.css
    │   └── chunk-XXXX.js
    │
    └── server/
        ├── server.mjs
        ├── main.server.mjs
        └── ...

The distinction is important:

browser/
   ↓
Files executed/downloaded by browser

server/
   ↓
Files used for server-side rendering

The exact SSR filenames depend on the Angular version and build configuration.


12. Angular + ASP.NET Core Web API

For your typical architecture:

Angular
   |
   | HTTPS
   ↓
ASP.NET Core Web API
   |
   ↓
SQL Server

Angular might be built with:

ng build --configuration production

producing something like:

dist/
└── portfolio/
    └── browser/
        ├── index.html
        ├── main-XXXX.js
        ├── styles-XXXX.css
        ├── chunk-XXXX.js
        └── assets/

These Angular files can be hosted using IIS, Nginx, Azure Static Web Apps, a CDN/static host, or—if you choose—a configured ASP.NET Core static-file host.

Your ASP.NET Core Web API is not placed inside Angular's dist folder merely because Angular calls it.

They are separate applications:

Angular build
     ↓
dist/browser
     ↓
Web Server


ASP.NET Core Web API
     ↓
API Server
     ↓
SQL Server

13. Full simple example

Consider:

// products.ts

import { Component } from '@angular/core';

@Component({
    selector: 'app-products',
    standalone: true,
    template: `
        <h1>Products</h1>

        @for (product of products; track product.id) {
            <p>{{ product.name }}</p>
        }
    `
})
export class Products {

    products = [
        { id: 1, name: 'Laptop' },
        { id: 2, name: 'Mouse' }
    ];

}

Build:

ng build

Angular processes:

products.ts
app.ts
main.ts
styles.css
index.html
       │
       │ ng build
       ▼
Compile
       ↓
Bundle
       ↓
Optimize
       ↓
Generate static output
       ↓
dist/

A simplified output could be:

dist/
└── my-app/
    └── browser/
        ├── index.html
        ├── main-72HJ3K.js
        ├── styles-92KD8F.css
        └── chunk-38DH2A.js

These are the files that are served to users.


Key Points

File / Folder Purpose
index.html Entry HTML page
main-*.js Main Angular application JavaScript
chunk-*.js Split/shared/lazy-loaded JavaScript
styles-*.css Application/global styles
Static assets Images, fonts, documents, etc. configured for copying
browser/ Browser-side output in modern application builds
server/ Server-side output when SSR is configured

Remember the core flow:

Angular Source
    ↓
ng build
    ↓
Compile
    ↓
Bundle
    ↓
Optimize
    ↓
dist/
    ↓
Web Server
    ↓
Browser

dist contains the generated deployable output of the Angular build, not the Angular development source code.


Interview Questions and Answers

1. What is the dist folder in Angular?

The dist folder contains the build output generated by ng build. It contains the HTML, JavaScript, CSS, and static assets required to deploy the Angular application.

2. How do you generate the dist folder?

Run:

ng build

or explicitly:

ng build --configuration production

3. Should we deploy the src folder?

No. Normally, you deploy the generated build output rather than your TypeScript source directory.


4. What is index.html?

It is the application's main HTML entry document. It loads the resources required to bootstrap the Angular application.


5. What is main-*.js?

It is generated JavaScript containing core application code produced by Angular's build process.


6. What are chunk-*.js files?

They are JavaScript chunks generated through code splitting. They can contain shared or lazy-loaded application code.


7. Why does Angular add hashes to generated filenames?

For cache busting.

Example:

main-ABC123.js

After a new deployment:

main-XYZ789.js

The changed URL encourages browsers to retrieve the new version.


8. Does dist contain TypeScript files?

Normally no. Angular processes TypeScript/application source into browser-ready JavaScript bundles.


9. What is the difference between browser and server inside dist?

browser contains files intended for the browser. server is present when applicable for server-side rendering and contains server-side build output.


10. Can the Angular dist files be hosted in IIS?

Yes. Angular's browser build output consists primarily of static files and can be hosted by IIS when IIS is configured correctly for SPA routing.

Interview one-line answer

The Angular dist folder is the deployment output generated by ng build, containing optimized HTML, JavaScript bundles/chunks, CSS, and configured static assets needed to run the built application.

← Back to Articles