Webpack error in console while building app.bundle.js - ionic serve


#1

I have reference the third party libraries like lodash and cordova. While my application works fine without any issues. i am able to use all the lodash and cordova features, I see this error when i do ionic serve.

I was wondering, is a configuration i need to do to get rid of this errors.

Thanks,
Vasanth


#2

Hi @mhartington , Do you have any suggestions for this issue?


#3

Hey there, so this is with Typescript?

Basically those errors mean that typescript just doesn’t understand the code you’re using.

See http://mhartington.io/post/ionic2-external-libraries/

General idea is that you need to install type definition files for those libs, like Lodash.

As for the Camera errors, try using our new ionic-native lib.

http://ionicframework.com/docs/v2/native/Camera/

npm install --save ionic-native

Then in your code you can do


import {Page} from 'ionic-angular';
import {Camera} from 'ionic-native';
@Page({
  templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
  constructor(){}
  takePhoto(){
    Camera.getPicture(options).then((imageData) => {
      // imageData is either a base64 encoded string or a file URI
      // If it's base64:
      let base64Image = "data:image/jpeg;base64," + imageData;
    }, (err) => {
    });
  }
}
```