firescript / nativescript-contacts

A nativescript module that gives access to the native contact directory.
MIT License
28 stars 32 forks source link

AOT Build issue: contacts Could not find module './get-all-contacts-worker.js #33

Closed Jaishankarb closed 5 years ago

Jaishankarb commented 7 years ago

the plugin is working fine in the normal release build mode but when we build in the AOT release mode the app crashes can you please look at the below error messages

JS ERROR Error: Could not find module './get-all-contacts-worker.js'. Computed path '/var/mobile/Containers/Data/Application/2896D048-EF2B-4A21-ABDF-E08EF46154E9/Library/Application Support/LiveSync/app/get-all-contacts-worker.js'. JS ERROR TypeError: console.dump is not a function. (In 'console.dump(e)', 'console.dump' is undefined)

kindly help us

iguissouma commented 6 years ago

Same issue here, Any workaroud for this problem?

Jaishankarb commented 6 years ago

nativescript-contacts-lite-0.2.3.zip

use the attached one for AOT this work around

"nativescript-contacts": "^1.5.3", "nativescript-contacts-lite": "./nativescript-contacts-lite-0.2.3.tgz",

iguissouma commented 6 years ago

thanks. I downgraded to 1.5.3, aot seems working with this version... But I'm having another problem Error:No Accounts! when I try to add a contact, I'm testing on my device with sim.

DeepakArora76 commented 6 years ago

Replace the following lines in the files index.ios.js and index.andriod.js

exports.getAllContacts = function(contactFields) { return new Promise(function (resolve, reject) { var worker = new Worker('./get-all-contacts-worker.js');

exports.getAllContacts = function(contactFields) { return new Promise(function (resolve, reject) { var worker; // Check if webpack is used, in which case, load using webpack loader, otherwise load using relative path // Using webpack assumes that the nativescript worker loader is properly configured. See https://github.com/NativeScript/worker-loader if (global["TNS_WEBPACK"]) { var myWorker = require('nativescript-worker-loader!./get-all-contacts-worker.js'); worker = new myWorker(); } else { worker = new Worker('./get-all-contacts-worker.js'); // relative for caller script path }