填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫Home

ng run

在你的專案中執行一個帶有自訂建構器配置的建築師目標(Architect target)。

Runs an Architect target with an optional custom builder configuration defined in your project.

ng run <target> [options]
      
      ng run <target> [options]
    

說明

建築師(Architect)是 CLI 用來根據所提供的配置執行復雜任務(例如編譯)的工具。CLI 命令會執行建築師目標(target),例如 buildservetestlint 。每個命名目標都有一個預設配置,由 "options" 物件指定,在 "configurations" 物件中有一組可選的命名備用配置。

Architect is the tool that the CLI uses to perform complex tasks such as compilation, according to provided configurations. The CLI commands run Architect targets such as build, serve, test, and lint. Each named target has a default configuration, specified by an "options" object, and an optional set of named alternate configurations in the "configurations" object.

例如,新產生的應用程式的 "serve" 目標具有名為 "production" 的預定義備用配置。

For example, the "serve" target for a newly generated app has a predefined alternate configuration named "production".

你可以在 angular.json 檔案的 "architect" 部分定義新目標及其配置選項。這樣,以後就可以使用 ng run 命令來從命令列執行它們。使用以下格式執行命令。

You can define new targets and their configuration options in the "architect" section of the angular.json file. If you do so, you can run them from the command line using the ng run command. Execute the command using the following format.

ng run project:target[:configuration]
      
      ng run project:target[:configuration]
    

引數

引數說明
<target>

要執行的建築師目標。

The Architect target to run.

選項

選項說明
--configuration=configuration

建構器的一個或多個命名配置,是一個逗號分隔的列表,就像在 angular.json 的 "configurations" 部分指定的一樣。 本建構器使用這些命名配置來執行給定的目標。 欲知詳情,參見 https://angular.cn/guide/workspace-config#alternate-build-configurations。

One or more named builder configurations as a comma-separated list as specified in the "configurations" section of angular.json. The builder uses the named configurations to run the given target. For more information, see https://angular.io/guide/workspace-config#alternate-build-configurations.

別名: -c

--help=
true|false|json|JSON

在控制檯顯示關於本命令的幫助資訊。

Shows a help message for this command in the console.

預設值: false