Back to Nx

Set Continuous Option

packages/angular/src/migrations/update-21-0-0/set-continuous-option.md

22.7.11.7 KB
Original Source

Set continuous Option for Continuous Tasks

This migration sets the continuous option to true for tasks that are known to run continuously, and only if the option is not already explicitly set.

Specifically, it updates Angular targets using the following executors:

  • @angular-devkit/build-angular:dev-server
  • @angular-devkit/build-angular:ssr-dev-server
  • @nx/angular:dev-server
  • @nx/angular:module-federation-dev-server
  • @nx/angular:module-federation-dev-ssr

Examples

Before
json
{
  // ...
  "targets": {
    // ...
    "serve": {
      "executor": "@angular-devkit/build-angular:dev-server",
      "options": {
        "buildTarget": "my-app:build",
        "port": 4200
      }
    }
  }
}
After
json
{
  // ...
  "targets": {
    // ...
    "serve": {
      "continuous": true,
      "executor": "@angular-devkit/build-angular:dev-server",
      "options": {
        "buildTarget": "my-app:build",
        "port": 4200
      }
    }
  }
}

When a target is already explicitly configured with a continuous option, the migration will not modify it:

Before
json
{
  // ...
  "targets": {
    // ...
    "serve": {
      "continuous": false,
      "executor": "@nx/angular:dev-server",
      "options": {
        "buildTarget": "my-app:build",
        "port": 4200
      }
    }
  }
}
After
json
{
  // ...
  "targets": {
    // ...
    "serve": {
      "continuous": false,
      "executor": "@nx/angular:dev-server",
      "options": {
        "buildTarget": "my-app:build",
        "port": 4200
      }
    }
  }
}