填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

ng run

在你的项目中运行一个带有自定义构建器配置的建筑师目标(Architect target)。

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

      
      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]
    

参数

参数说明Value Type
<target>

要运行的建筑师目标。

The Architect target to run.

string

选项

选项说明Value TypeDefault Value
--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

string
--help

在控制台显示关于本命令的帮助信息。

Shows a help message for this command in the console.

true|false|json|JSONfalse