Angular workspaces and the angular.json file

When you generate an Angular application using the Angular CLI (that is, ng new ...​), it creates a workspace for you. An Angular workspace is simply a directory that contains one or more Angular projects, which are themselves either applications or libraries.

Angular libraries aren't full-blown applications, but they contain reusable elements. They become useful when you work on multiple applications in parallel that share some elements like components, directives, services.

At the root of every Angular workspace, you should find an angular.json file. This is the configuration file of the workspace. Inside it, all projects that are part of the workspace are listed, along with their configurations. Additionally, you can fine-tune the build system and tools (either for the whole workspace or project-by-project).

Here are a few simple examples of things that you can configure for a project:

  • outputPath: The folder where the build output will be saved
  • index: The HTML file to use as an entry point (this defaults to src/index.html)
  • main: The file to use as an entry point (this defaults to src/main.ts)
  • assets: An array of assets to include in the output of the build
  • configurations: Environment-specific configurations or customizations
  • budgets: A way to keep an eye on build sizes by setting soft and hard limits

The angular.json file provides extensive control over the build process. Once you get more familiar with the framework, you'll come to appreciate this flexibility.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.190.156.212