Types of dependencies in Angular

Dependencies provide a variety of functions. While executing your application, you’ll require some dependencies while building your project.

As a result, you might have a variety of various forms of dependencies (e.g. dependencies, devDependencies, and peerDependencies).

Your package.json will contain all of these dependencies:

  "name": "my-project",
  "dependencies": {
    "package-a": "^1.0.0"
  "devDependencies": {
    "package-b": "^1.2.1"
  "peerDependencies": {
    "package-c": "^2.5.4"
  "optionalDependencies": {
    "package-d": "^3.1.0"

The majority of individuals simply have dependencies and devDependencies, however it’s crucial to comprehend each of them.

  • Dependencies    :
      • These are your typical dependencies, or rather, the ones you require for your code to operate (e.g. React or ImmutableJS).
  • dev Dependencies  :
      • Your development dependencies are listed here. Dependencies you require throughout some stages of the development process but not while running your code (e.g. Babel or Flow).
  • Peer Dependencies :
      • Peer dependencies are a unique kind of dependencies that would only ever arise if you were releasing your own package.

        If your package has a peer dependence, it requires a requirement that is identical to the dependency required by the user installing your package. This is advantageous for packages like react that require a single instance of react-dom that is also used by the user installing the package.

  • optional Dependencies : 
      • Dependencies that are optional are simply that—optional. Yarn will still claim that the installation procedure was successful even if they don’t instal.

        This is helpful for dependencies that might not always function on all computers and you have a backup strategy in case they are not installed (e.g. Watchman).

  • bundle Dependencies :
      • Array of package names that will be bundled when publishing the package.

        Bundled dependencies should be inside your project. The functionality is basically the same as normal dependencies. They will also be packed when running yarn pack.

Submit a Comment

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


Select Categories