When we use the native api contact Contacts on ionic4, the following error message will appear:
ERROR in ./node_modules/@ionic-native/contacts/ngx/index.js 20:126
[ng] Module parse failed: Identifier 'checkAvailability' has already been declared (20:126)
[ng] You may need an appropriate loader to handle this file type.
[ng] | return c > 3 && r && Object.defineProperty(target, key, r), r;
[ng] | };
[ng] > import { IonicNativePlugin,cordovaInstance,checkAvailability, instanceAvailability, instancePropertyGet, instancePropertySet, checkAvailability, getPromise } from '@ionic-native/core';
[ng] | var Contact = /** @class */ (function () {
[ng] | function Contact() {
The reason is: repeated import of checkAvailability
solution:
Open the file node_modules\@ionic-native\contacts\ngx\index.js
turn up
import { IonicNativePlugin,cordovaInstance,checkAvailability, instanceAvailability, instancePropertyGet, instancePropertySet, checkAvailability, getPromise } from '@ionic-native/core';
You will find that there are two checkAvailability in it, just delete one.
Welcome to the (Q) group to help you solve problems: