tjvantoll / nativescript-social-share

♻️ A NativeScript plugin for using the iOS/Android social sharing widgets
MIT License
94 stars 48 forks source link

Error: Can't resolve 'tns-core-modules/ui' #51

Open panagulis72 opened 4 years ago

panagulis72 commented 4 years ago

Hi, when I build my application for android it works, but when I build for ios (tns build ios --env.uglify --env.aot --env.snapshot) I get the following error:

ERROR in ../node_modules/nativescript-social-share/social-share.js Module not found: Error: Can't resolve 'tns-core-modules/ui' in '/Users/user/Documents/app/node_modules/nativescript-social-share' @ ../node_modules/nativescript-social-share/social-share.js 4:11-41 @ ../$$_lazy_route_resource lazy namespace object @ ../node_modules/@angular/core/fesm5/core.js @ ./main.ts Executing webpack failed with exit code 2.

These are the versione in package.json: "tns-core-modules": "6.0.1", "nativescript-social-share": "^1.5.2"

I tried to update nativescript-social-share to last versione but it doesnt work. Unfortunatly, I cannot update core-modules to 6.2

panagulis72 commented 4 years ago

I saw that the error comes from social-share.ios.js, with this it works:

var frame_1 = require("tns-core-modules/ui/frame");
......
 var page = frame_1.topmost().currentPage;
drewjbartlett commented 4 years ago

@panagulis72 how are you able to fix this since it's built in your node_modules?

vivek-aecor commented 4 years ago

Hi, when I build my application for android it works, but when I build for ios so i get the following error: for console.log("topmost() is deprecated. Use Frame.topmost() instead.");

These are the versione in package.json: "tns-core-modules": "^6.4.2", "nativescript-social-share": "1.6.0",

nbeers22 commented 4 years ago

@panagulis72 how are you able to fix this since it's built in your node_modules?

@drewjbartlett - if you go to node_modules/nativescript-social-share/social-share.ios.js you can update the code there.

` var utils_1 = require("tns-core-modules/utils/utils");

// var ui_1 = require("tns-core-modules/ui");

var frame_1 = require("tns-core-modules/ui/frame");

function share(thingsToShare) {

    var activityController = UIActivityViewController.alloc()

        .initWithActivityItemsApplicationActivities(thingsToShare, null);

    var presentViewController = activityController.popoverPresentationController;

    if (presentViewController) {

        var page = frame_1.topmost().currentPage;

`