Extend Angular 2 Cli with Addons

For this you’ll first have to use local copy of the CLI, coz addons aren’t officially supported yet. For this do:

git clone https://github.com/angular/angular-cli.git
cd angular-cli
npm link

npm link is very similar to npm install -g except that instead of downloading the package from the repo, the just cloned angular-cli/ folder becomes the global package. Any changes to the files in the angular-cli/ folder will immediately affect the global angular-cli package, allowing you to quickly test any changes you make to the cli project.

Now you can use angular-cli via the command line:

ng new foo
cd foo
npm link angular-cli
ng serve

So now that you have the new app running with local CLI, modify the cli code and restart the app for change to take affect.
For eg. Here I show how to enable Hot Module Reloading using the Angular CLI Addon


One thought on “Extend Angular 2 Cli with Addons”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s