Using lodash in Angular 4
问题 I have previously used lodash in my Angular 4 application by simply importing it and using it as shown here: import lodash from 'lodash'; public getSubtotal() : number { return lodash.sumBy(this.cartItems, function(item) { return item.product.price * item.item.quantity; }) } I am once again trying to use lodash similarly but am getting an error that lodash is undefined. import lodash from 'lodash'; lodash.indexOf([1, 2, 1, 2], 2); I get the following error: ERROR TypeError: Cannot read