Lodash module not found after upgraded to RC0

Hi there,

I followed the upgrade note

npm install @types/lodash --save-dev --save-exact

I even created a new project with no luck!

Do we still need to install lodash?

npm install lodash --save

My environment:

Cordova CLI: 6.3.1
Gulp version: CLI version 3.9.1
Gulp local:
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
OS: Windows 7 SP1
Node Version: v6.7.0

Anyone pointers?

Thanks

I managed to get it working by installing both lodash and @types/lodash … then doing something like this:

import * as _ from 'lodash';

_.merge(...);

You will still get some warnings in the build, but you can ignore them, the app will work fine.

Instead of the wildcard import, I would recommend following the guidance in here.

1 Like

thanks @rapropos, didn’t see that

I managed to get rid of the warnings by using import _ from 'lodash' instead of import * as _ from 'lodash'

Hi @ihadeed, @rapropos,

I’ve tried the following:

  1. npm install lodash --save

  2. npm install @types/lodash --save-dev --save-exact

  3. In my script import _ from “lodash”;

It doesn’t complain module cannot be found, but when I run ionic serve compile with error.

…\node_modules\lodash\lodash.js does not export default.

any clues?

My package.json look like this

“dependencies”: {
"@ionic/storage": “^1.0.3”,
"@types/lodash": “^4.14.36”,
“angularfire2”: “^2.0.0-beta.5”,
“firebase”: “^3.4.1”,
“ionic-angular”: “^2.0.0-rc.0”,
“ionic-native”: “^2.0.3”,
“ionicons”: “^3.0.0”,
“lodash”: “^4.16.3”
},
“devDependencies”: {
"@ionic/app-scripts": “latest”,
"@types/lodash": “4.14.36”,
"@types/request": “0.0.30”,
“typescript”: “^2.0.3”
},

Thanks,
Dennis