liveBook · Manning

Angular.json

As explained in Modern Angular

angular.json is the Angular CLI workspace configuration file that defines project, build, and development-tool settings.

angular.json is the Angular CLI workspace configuration file for project, build, and development-tool settings. Modern Angular projects generate a shorter file than older projects, alongside standalone application structure and fewer default files. section 1.3.2

The file becomes especially important when an application needs deployment-specific behavior. Server-side rendering adds build properties for the server entry point, prerendering, and the SSR entry file, while leaving much of the configuration familiar. section 9.2.1

Common configuration responsibilities include:

  • Selecting the server entry point and enabling prerendering for an SSR application. section 9.2.1
  • Replacing the base environment file with a development, QA, or other environment-specific file. section 9.4.3
  • Running a selected configuration during builds or local development with the Angular CLI. section 9.4.3

Adding a QA environment

Run ng generate environments, add a QA environment file and matching configuration, then run ng build --configuration qa. Angular uses the configured file replacement so imports continue to target environment.ts. section 9.4.3

Listing 9.3 angular.json file of an SSR application
"build": {
       "builder": "@angular-devkit/build-angular:application",
       "options": {
 #1
       "server": "src/main.server.ts",  #2
       "prerender": true,  #3
       "ssr": {
         "entry": "server.ts"  #4
       }
     },
}

Inspect the compact SSR build configuration, including server, prerender, and server entry settings. section 9.2.1

"development": {
  "optimization": false,
  "extractLicenses": false,
  "sourceMap": true,
  "fileReplacements": [
    {
      "replace": "src/environments/environment.ts",
      "with": "src/environments/environment.development.ts"
    }
  ]
}

Inspect a development configuration that disables optimization, preserves source maps, and replaces the base environment file. section 9.4.3

How Modern Angular covers it

How deep it goes
Explains representative build and file-replacement options, but stops short of exhaustively detailing the full workspace schema.
Examples
Uses a modern HRMS workspace, an SSR build configuration, and development or QA environment file replacements.
What it assumes
Assumes familiarity with Angular CLI projects and introduces environment files as an optional configuration workflow.
What you can do after
Operate/configure Angular CLI builds by selecting SSR settings and environment-specific file replacements.
How it connects
Connects Angular CLI, environment files, server-side rendering, prerendering, builds, and local application serving.

Also explained in

Compare how 2 books explain angular.json →

Related concepts

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