Difference between Angular-cli.json , webpack.conf & tsconfig.json

1) As Angular4 can be preferably use with typescript but you can also use dart and ES5 javascript well for developing an application. Now

angular-cli.json

tsconfig.json

webpack.conf.js

angular-cli.json

Angular CLI is a Command Line Interface (CLI) to automate your development workflow. It allows you to:

  • Create a new Angular application
  • run a development server with LiveReload support to preview your application during development
  • add features to your existing Angular application
  • build your application for deployment to production

So automating the angular application from cli requires angular-cli.json to loads its configuration.

TypeScript is a primary language for Angular application development. It is a superset of JavaScript with design-time support for type safety and tooling.

Browsers can't execute TypeScript directly. Typescript must be "transpiled" into JavaScript using the tsc compiler, tsconfig.json— file is required for TypeScript compiler configuration.

webpack.conf.js its also a bundler and it provide the same configuration functionality as angular cli, but in webpack you have to do it manually as in case of angular cli you can take advantage of Angular CLI command line help without knowing detail information

2) You are required angular-cli.json and tsconfig.json if u developing an angular app through CLI

if using own bundler like webpack or systemjs you can have tsconfig.json and bundler configuration file in this case webpack.config.js

3) For best practises it would prefer to use ANGULAR CLI you can check out the official documentation


Wasiq answer is great & I want to share some more aggregated information which may helped me to understand angularcli.json & webpack.config.json better.

A project need to have a bundler, regardless of the technology stack.

Webpack.conf.js - Bundler

Webpack is one of bundler quite popular due to features it brings to table. It scans import statement & maintains a dependency tree, that allows it to only bundle resources and js files your code actually uses. But it requires loaders and plugins configuration which sometimes may be little difficult to follow through.

angular-cli - Bundler but provides other useful features, ex: generating a pre scaffolded angular app or generating components/services

Angular team has created anguar-cli – a very powerful bundler tool, beauty is this that it uses Webpack under the hood, already pre-configured, so you enjoy the benefits without the hassle of configuration. So you dont miss features from webpack but angular-cli saves a lot of effort.

You still have access to project configuration files like karma.conf.js, protractor.conf.js, tslint.json, tsconfig.json and package.json.


To precise easily,

  1. angular-cli.json is the configuration file for angular cli generator for angular apps which uses webpack by default internally

  2. tsconfig.json is the configuration file for typescript compiler

  3. webpack.config is the configuration file for webpack bundler for js/css. When you prefer your own development workflow this file is needed instead of angular-cli.

Note: If you use angular-cli for angular apps, tsconfig.json will be generated automatically. But we need to manually construct tsconfig.json when we prefer webpack bundler.