liveBook · Manning

Entry point

As explained in Pro Angular 16

An entry point is the initial source module from which a build tool discovers an application's dependency graph.

An entry point is the initial source module from which a build tool discovers an application's dependency graph. In an Angular application, src/main.ts serves this role: webpack starts there, follows its import statements, and compiles the referenced TypeScript and template files into application bundles. section 9.3.2

The entry point also begins browser startup. After importing Angular platform functionality and AppModule, main.ts calls platformBrowserDynamic().bootstrapModule(AppModule). This initializes Angular for the browser and connects Angular's framework code with the application's custom code. section 9.4.2

The entry point determines both the build's starting location and the runtime initialization path:

  • Webpack begins with main.ts and recursively follows the modules named by its import statements. section 9.3.2
  • The compiled output from the application source becomes the main.js bundle; its name derives from the entry point. section 9.4.2
  • Executing main.ts starts Angular by bootstrapping AppModule after platformBrowserDynamic initializes the browser platform. section 9.4.2
  • Changing files included in the main.js dependency graph causes the affected bundles to be rebuilt during ng serve. section 9.3.2

Angular's main.ts entry point

A generated Angular project uses main.ts as its entry point: it imports platformBrowserDynamic and AppModule, then calls platformBrowserDynamic().bootstrapModule(AppModule). The imports expose Angular features and application code; the bootstrap call starts the application. section 9.4.2

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
 
import { AppModule } from './app/app.module';
 
platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.error(err));

Inspect the complete main.ts listing to see how imports and the bootstrap call form the build and runtime starting point. section 9.4.2

How Pro Angular 16 covers it

How deep it goes
Explains dependency traversal, bundle naming, and bootstrap calls, but does not detail webpack configuration internals.
Examples
Uses src/main.ts, AppModule, main.js, and incremental ng serve rebuilds as concrete examples.
What it assumes
Assumes familiarity with JavaScript modules and imports while introducing Angular platform initialization and root-module bootstrapping.
What you can do after
Evaluate/understand how a source module drives Angular startup, dependency compilation, bundle creation, and incremental rebuilding.
How it connects
Connects entry points with webpack, module bundling, dependency graphs, Angular modules, and application bootstrap.

Also explained in

Compare how 10 books explain entry point →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pro Angular 16. The section links point to the parts of the book it draws on.