Search code examples
typescriptlodash

How to use lodash function in angular 5 project?


I want to use merge function from lodash. If I am including whole lodash , it increases bundle size . So I am trying to use function from lodash. But it is giving error.

import { merge } from 'lodash/merge';

or

  import merge from 'lodash/merge';

Can anyone suggest me how to use this in angular 5 application ? I have installed following versions:

 "lodash": "^4.17.5",
  "@types/lodash": "^4.14.104"

Solution

  • import * as merge from 'lodash/fp/merge'; worked fine