If I do nothing and add the type definition it works for jquery but lodash gets a
'_' referes to a UMD global, but the current file is a module. Consider adding an import instead.
If I try to import lodash with any combination of import call, I get
lodash.js is not a module
I tried to get help by asking a question here and it was closed because there was another answer for Angular (Angular 2). I really need a real answer so I'm re-posting with my own solutions, hoping someone will eventually help me understand this problem.
In this case I am:
I use import * as _ from 'lodash';
in my working file after installing lodash.
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 - begin
declare namespace _ {
}
// lodash global typing - end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With