Tealium / tealium-nativescript-plugin

Other
0 stars 0 forks source link

index.ios.ts is missing from the TypeScript compilation #9

Open liuy97 opened 2 years ago

liuy97 commented 2 years ago

ns 8.1.4

  1. unzip demo.zip demo.zip

  2. npm i

  3. ns build ios

ERROR in ./node_modules/@tealium/nativescript-plugin/index.ios.ts

craigrouse commented 2 years ago

@liuy97 I believe this is an issue with your app, not with the plugin. It could be related to upgrading the nativescript platform version in your app from an earlier version. I can successfully create a new nativescript app using 8.1.4, add the Tealium plugin, and build without errors, but your demo project throws the error you described.

These are the steps I took:

  1. Clone repo
  2. tns create - create a default Angular template app
  3. npm i @tealium/nativescript-plugin
  4. tns run ios

I can't see any issues in our package, and it works fine with our demo project. Sorry we can't be more helpful in this instance.

liuy97 commented 2 years ago

@craigrouse, Thanks for your qucik reply. I also created this demo from default template. However, you did not add any tealium-related code, did you? I have to call Tealium.initialize(config) in analytics.util.ts. Do I miss something? or this plugin does not need to initialize.

craigrouse commented 2 years ago

@liuy97 OK, I do see the error if I try to add some Tealium code to the app I created. I can resolve it by adding the file it claims is missing to the app's tsconfig.json, but it then crashes at runtime with a JS error. I believe this may be a bug in the NativeScript Angular plugin. I'll try a pure TypeScript app next without Angular and see if that works - this is what our demo app on the repo is, and that works perfectly.

liuy97 commented 2 years ago

Thanks. We plan to integrate this plugin into your app (Nativescript + Angular). I hope that you can provide a sample for Nativescript and Angular too.

fpaaske commented 2 years ago

@craigrouse Any idea on how to get this to work for NativeScript + Angular?

craigrouse commented 2 years ago

@fpaaske @liuy97 We are looking into it, but I don't have an immediate fix. As far as I can tell, there is nothing wrong with the plugin that should prevent it from working with Angular - I believe this is a NativeScript issue. Hopefully we'll be able to find a workaround. Let us know if you find one in the meantime.

liuy97 commented 2 years ago

@craigrouse , I have fixed this bug via rebasing your code with plugin-seed , refs https://github.com/liuy97/tealium-plugin. It works as expected now.

craigrouse commented 2 years ago

@liuy97 Thank you for this! We were in the process of coming up with a solution, but it was a lot more complicated than this. We'll take a look, and assuming this works for us, we'll get it merged into our repo. Appreciate you taking the time to let us know.

trister1997 commented 2 years ago

@liuy97 I have been looking into this issue and still seem to be having problems. I tried installing it via the repo you had sent and still get the error that the index.ios.ts is missing. Did you make any configuration changes on your angular project / could you possibly setup a working demo project and attach it here?

liuy97 commented 2 years ago

No. I have committed all codes.

npm start select @nativescript.build-all

npm start select apps.demo-angular.ios

Simulator Screen Shot - iPhone 8 Plus - 2021-11-03 at 15 50 14

However, if you install from a npm package into another project, you need the following in references.d.ts

/// <reference path="./node_modules/@tealium/nativescript-plugin/platforms/android/typings/android.d.ts" />
/// <reference path="./node_modules/@tealium/nativescript-plugin/platforms/ios/typings/ios.d.ts" />
fpaaske commented 2 years ago

@craigrouse @trister1997 did you get any further with this? It would be great to have an official Tealium plugin to use in our NativeScript + Angular app.

craigrouse commented 2 years ago

@fpaaske I do apologise - this had fallen off our radar. We'll take another look at it and get back to you. If you have any suggestions, then do let us know; we aren't experts in NativeScript, and as far as I know we did everything properly (and it works with a pure JS NativeScript implementation), so I'm not sure exactly what's wrong.