Lodash - '_' refers to a UMD global and lodash.js is not a module errors Lodash - '_' refers to a UMD global and lodash.js is not a module errors typescript typescript

Lodash - '_' refers to a UMD global and lodash.js is not a module errors


I added following code in my global typing definition file (~\src\typings.d.ts) to fix the problem. I'm using Angular CLI 1.7

// lodash global typing - begindeclare namespace _ {}// lodash global typing - end


I added in my ~\src\typings.d.ts :

declare const _;

It works for me. See also


I use import * as _ from 'lodash'; in my working file after installing lodash.