Questions tagged [angular-cli]

The Angular CLI is a command line interface for building, managing and deploying Angular (version 2+) applications.

The Angular CLI is a command line interface for building, managing and deploying Angular (version 2+) applications. It can be used to generate part of the application, serving in a local server, analysing code quality, etc. It is based on ember-cli project.

Installation

npm install -g @angular/cli

Usage

ng help

Generating and serving an Angular project via a development server

ng new PROJECT-NAME
cd PROJECT-NAME
ng serve

For more information, please visit the following links.

7329 questions
31
votes
4 answers

Angular 6 library shared stylesheets

How can you setup a index.scss and import global stylesheets for variables, mixins, etc, to an angular 6 library? Angular CLI generates a lib with a root component & component scss, but the styles added or imported to the root component are not…
xaunlopez
  • 439
  • 1
  • 4
  • 13
31
votes
2 answers

angular-cli run command after ng build

I am wondering how to extend ng build to run tasks after it has finished. At the moment, my end goal is to copy my 'package.json' to the dist folder. Something like this if I was using plain npm: "postbuild": "cpx ./package.json ./dist/", I know in…
mrshickadance
  • 1,213
  • 4
  • 20
  • 34
30
votes
4 answers

How do I turn off source maps for Angular 6 ng test?

I am trying to turn off sourcemaps for my tests in Angular 6. I know the sourcemaps switch has been removed, e.g., ng test --sourcemaps=false. I have tried modifying my tsconfig file: { "extends": "../tsconfig.json", "compilerOptions": { ... …
ja6a
  • 416
  • 1
  • 6
  • 10
30
votes
5 answers

how to enable gzip compression in angular cli for production build

I would want to compress the bundle files that are created when building the angular project. I use ng build --environment=${environment} to build the application currently and the version of "@angular/compiler-cli": "^4.0.0" do not generate the .gz…
Cling
  • 489
  • 1
  • 6
  • 15
30
votes
4 answers

Properly using environment.ts in my angular4 application with angular-cli

I use Intellij Ultimate to code my angular 4 application. I created a new Angular 4 project, it contains environment.ts and environment.prod.ts and the environments are properly configured in angular-cli.json. how do I import it in my code? Since…
ufk
  • 30,912
  • 70
  • 235
  • 386
30
votes
12 answers

How to deploy angular-cli app on iis

I have simple angular2-cli app (one page with model driven form - no router involved). With "ng serve" all works fine. I made production version with ng build --product. I copied all ./dist folder content into new folder under C:\inetpub\wwwroot. I…
PaulStanek
  • 451
  • 2
  • 5
  • 7
30
votes
10 answers

Running an angular 2 application built locally on Chrome using angular-cli without a node server

I will make my Angular 2 question very precise. 1. I am using: Angular 2, angular-cli: 1.0.0-beta.15, ( webpack building ) node: 6.4.0, os: linux x64 2. What I want to achieve: I want to build my project in a way that after the build ( ng…
BartB
  • 413
  • 1
  • 5
  • 9
29
votes
10 answers

How to find the angular Invalid version 15.2-15.3 error?

I created a new angular app with the angular CLI 13.0.4. It created an angular app version ~13.0.0. When I use the command ng build, I get the following error: ./node_modules/css-loader/dist/runtime/api.js - Error: Module build failed (from…
wonderful world
  • 10,969
  • 20
  • 97
  • 194
29
votes
9 answers

Running Visual Studio 2017 with Angular 4 and Angular CLI

Is it possible to run an Angular CLI generated project in Visual Studio 2017? I tried generating a Hello World application and Visual Studio 2017 can't run it. ng new HelloWorld I opened the folder as a website and clicked start. Has anyone else…
Greg Finzer
  • 6,714
  • 21
  • 80
  • 125
29
votes
3 answers

How to undo Angular 2 Cli ng-eject?

I have just executed the ng eject command. But now I need to revert it, and continue to use ng commands. Is it possible? I would be grateful for any help.
user4230508
29
votes
3 answers

Load external libraries from CDN with angular-cli

I would like to use the angular-cli to build an app that bundles my app code but does not include the Angular2 framework or other large external JavaScript libraries in the bundled code. I would like to load these libraries from a CDN when the page…
Chris
  • 1,978
  • 3
  • 23
  • 35
28
votes
5 answers

How to specify environment via `ng build` in Angular 6 app

In Angular 5, we could generate build for different environments using ng build --prod --env=uat After migration to Angular 6 the above command throws error Unknown option: '--env'
Nehal Damania
  • 8,671
  • 9
  • 37
  • 52
28
votes
2 answers

ng build -prod vs ng build --prod --build-optimizer=true

My Angular project is @Angular4.3.3 ng build -prod Takes 77 seconds to make a build ng build --prod --build-optimizer=true Takes 190 seconds to make a build, No vendor chunk, less in size(but not a big difference in size though) Chunk…
Lahar Shah
  • 7,032
  • 4
  • 31
  • 39
28
votes
7 answers

Angular Error: 'Component 'X' is not included in a module...' when declared in a sub module

I'm trying to consolidate my dialogs into an Angular module, but I'm getting a linting error in the IDE: Component 'X' is not included in a module and will not be available inside a template. Consider adding it to an NgModule…
rawkfist0215
  • 1,445
  • 6
  • 21
  • 34
28
votes
11 answers

Versions of @angular/compiler-cli and typescript could not be determined

I have installed Angular/cli and then try to run command ng serve then below error is throwing. I have tried lot of thing like uninstall angular/cli, npm cache clean, etc Versions of @angular/compiler-cli and typescript could not be determined.…
Harshad Kumbhar
  • 391
  • 1
  • 4
  • 11