Angular 2 with lodash.

Simplest way to add lodash to your project is to install it with npm

npm install lodash --save  

and add to typescript file

import * as _ from 'lodash'  

But it means, that you get extra 69 Kb (23 Kb gzipped) in your build file. It's to much if you use only couple of functions and not all the library.

I use Angular CLI Webpack and it's very easy to use only needed functions from lodash.

First install ES6 lodash npm module

npm install lodash-es --save  

After that add typings definitions from @types repository

npm install @types/lodash --save-dev  

And finally in typescript file:

import { merge, mergeWith } from 'lodash';  

Know you have tiny pieces of lodash included in your project instead of all the library.