October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

Angular Configuration File: What angular.json Does and How to Edit It

Angular CLI settings live in the workspace-root angular.json. Learn how its project targets and named configurations work, and how to query or update settings safely.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In an Angular CLI workspace, the main configuration file is angular.json, located at the workspace root. It sets defaults for workspace projects and their CLI targets, including build, serve, and test. You can edit it directly or use ng config to read or change a specific setting.

Where is the Angular configuration file?

Look for angular.json at the top level of your Angular CLI workspace, usually alongside files such as package.json. Angular describes it as the workspace’s single CLI configuration file. Paths written in it are relative to the workspace root.

A workspace can contain one application or several applications and libraries. The names under projects do not always correspond directly to top-level folder names, particularly for the initial application.

What is angular.json used for?

angular.json supplies configuration defaults to Angular CLI tools. Its top-level properties can include workspace-wide settings such as version, newProjectRoot, cli, schematics, and projects. The cli section can configure behavior such as analytics, caching, package manager, schematic collections, and warnings.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Each entry in projects describes an application or library. It can specify properties such as the project root, project type, source root, selector prefix, internationalization settings, schematics, and CLI targets. Project settings may override workspace-level defaults, and command-line options can override project defaults.

Targets define what CLI commands do

A project’s architect section contains targets such as build, serve, test, and lint. A target identifies a builder and can define default options plus named configurations. Angular also documents targets for e2e testing and i18n extraction; custom targets can be invoked with ng run.

Build options can cover assets, styles, and scripts. Styles and scripts may be specified as file paths or as objects that describe an entry point, bundle name, and injection behavior. The valid properties depend on the builder and Angular version in use, so check the schema for the project’s installed version.

How do I change an Angular CLI setting?

You can edit angular.json in a code editor or use the CLI command ng config [json-path] [value] [options]. Omit the value to read a setting; supply a value to update it. For example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ng config projects.my-app.architect.build.options.outputPath
ng config projects.my-app.architect.build.options.outputPath dist/my-app

Replace my-app with the project name shown under projects. The exact JSON path must match the structure in your workspace. Property names in the file use camelCase, even where command-line flags use dash-case.

The --global option accesses CLI configuration in the caller’s home directory rather than the workspace’s angular.json. Use it when changing a user-level CLI setting, not a project-specific build or serve default.

How do named configurations and environment files work?

A target can define named configurations, often including development and production, with additional names such as staging possible. Choose one with --configuration. Multiple configuration names can be comma-separated; if they set the same property, the later configuration’s value takes precedence. Command-line options can also override configured defaults.

For example, a build target can hold shared options and separate alternatives:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
"configurations": {
  "development": { "optimization": false },
  "production": { "optimization": true }
}

Use the property names and values accepted by the builder in your Angular version; this snippet illustrates the structure, not a complete configuration.

Use fileReplacements for build-time substitutions

A target configuration can include a fileReplacements array to substitute one file for another in that build. Angular says no files are replaced by default. Its ng generate environments command can set up environment configuration automatically; follow the generated structure for your project’s Angular version. These replacements are build-time substitutions, not runtime environment-variable changes.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How is angular.json different from tsconfig.json?

These files configure different parts of a workspace. angular.json controls Angular CLI workspace projects and targets; tsconfig.json provides base TypeScript compiler settings that project-specific TypeScript configuration files can inherit.

File Primary purpose
angular.json Angular CLI workspace, project, and target configuration
tsconfig.json Base TypeScript settings, often inherited by project-specific configs
package.json Project dependencies and package scripts
package-lock.json Records installed package versions for npm

What should I check if a configuration change does not work?

  • Confirm the file and scope. Edit the workspace-root angular.json for project configuration; ng config --global addresses the caller’s home-directory CLI config instead.
  • Check the project and target path. Verify the project name under projects and locate the relevant target, such as build or serve, under architect.
  • Check which value wins. Project settings can supersede workspace defaults, a named configuration can change target options, later selected configurations take precedence for conflicting properties, and command-line options can override defaults.
  • Validate against the installed builder. Option names and accepted values can vary by Angular version and builder; consult the matching schema and CLI reference.
  • Check paths from the workspace root. Paths in angular.json are interpreted relative to that root.
  • Keep TypeScript settings in the right file. Compiler configuration belongs in the applicable tsconfig file, not in an Angular CLI target.

Official Angular references

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.