Module not found: Error: Can't resolve 'lodash-es'

Discussão em 'Angular' iniciado por user2846469, Dezembro 5, 2024.

  1. user2846469

    user2846469 Guest

    In my Angular 8 TypeScript code I was importing lodash directy (e.g. import * as _ from 'lodash';). In my package.json I had "lodash": "^4.17.15".

    I decided to install the @types/lodash-es module and import the specific lodash functions that way (e.g. import { map } from 'lodash-es';). It is better because it saves runtime space and also uses the standard Angular/TypeScript import mechanism.

    However, now when I run a build I am getting this error:

    Module not found: Error: Can't resolve 'lodash-es'

    How can I fix this error?

    Continue reading...

Compartilhe esta Página