English 中文(简体)
Angular CLI - ng run
  • 时间:2024-12-22

Angular CLI - ng run Command


Previous Page Next Page  

This chapter explains the syntax, argument and options of ng run command along with an example.

Syntax

The syntax for ng run command is as follows −


ng run project:target[:configuration]

ng run command runs an Architect target with an optional custom builder configuration defined in angular.json in your project. Here project is the name of the apppcation as defined in angular.json.

Arguments

The argument for ng run command is as follows −

Sr.No. Argument & Syntax Description
1 <target> Architect target to run.

Options

Options are optional parameters.

Sr.No. Option & Syntax Description
1 --configuration=configuration

A named builder configuration, defined in the "configurations" section of angular.json. The builder uses the named configuration to run the given target.

Apases: -c.

2 --help=true|false|json|JSON

Shows a help message for this command in the console.

Default: false.

First move to an angular project updated using ng generate command and then run the command.This chapter is available at https://www.tutorialspoint.com/angular_cp/angular_cp_ng_generate.htm.

Example

An example for ng run command is given below −


>Node>TutorialsPoint> ng run TutorialsPoint:build
Generating ES5 bundles for differential loading...
ES5 bundle generation complete.

chunk {polyfills} polyfills-es2015.js, polyfills-es2015.js.map (polyfills) 141 kB [initial] [rendered]
chunk {polyfills-es5} polyfills-es5.js, polyfills-es5.js.map (polyfills-es5) 656 kB [initial] [rendered]
chunk {main} main-es2015.js, main-es2015.js.map (main) 12.9 kB [initial] [rendered]
chunk {main} main-es5.js, main-es5.js.map (main) 15.1 kB [initial] [rendered]
chunk {runtime} runtime-es2015.js, runtime-es2015.js.map (runtime) 6.16 kB [entry] [rendered]
chunk {runtime} runtime-es5.js, runtime-es5.js.map (runtime) 6.16 kB [entry] [rendered]
chunk {styles} styles-es2015.js, styles-es2015.js.map (styles) 12.4 kB [initial] [rendered]
chunk {styles} styles-es5.js, styles-es5.js.map (styles) 13.9 kB [initial] [rendered]
chunk {vendor} vendor-es2015.js, vendor-es2015.js.map (vendor) 2.66 MB [initial] [rendered]
chunk {vendor} vendor-es5.js, vendor-es5.js.map (vendor) 3.11 MB [initial] [rendered]
Date: 2020-06-04T02:31:28.919Z - Hash: dd73885c28e550d01341 - Time: 13742ms

Here ng build command has built our project TutorialsPoint successfully.

Advertisements