Closed bigkingjohn closed 5 months ago
Yes I've seem that issue already. Version 13.10.0
should mitigate this issue (only instantiate if there's no existing instance) until a better solution is found (if you have any idea, fill free to share)
I don't know much about the capacitor plugin system, but presumably the "correct" instance of the javascript code is the one that is included in the bug chunk of code that Capacitor inserts at the top of the index.html file rather than the one that Angular packages up.
Is it possible to import just a types file in the angular code rather than the whole plugin javascript file? I think this would cause a problem when running the app as a website, I'm not sure if that is important. Would the angular transpiler/compiler raise an error when it discovers the implementation code doesnt exist?
Is this just an Angular problem or does it affect other frameworks like Ionic and React?
More questions than answers I'm afraid.
Observed behavior
I've created an angular app on top of Capacitor that uses your plugin.
After building to my phone from android studio I see the "Create CdvPurchase..." console log twice when I inspect the app in Chrome DevTools.
Expected behavior
Is this expected, or have I loaded the plugin incorrectly?
Is this likely to be safe to leave as it is? As far as I can tell, users are able to make purchases, so it looks like it's working.
Other info
This is how I'm using the plugin in my angular code:
npm install cordova-plugin-purchase --save
I dont recall there being any other capacitor related setup that I had to do in order to make it work.It looks like the plugin's javascript code is being loaded twice.
once as part of ~10k lines of javascript that capacitor has added to the top of what I think is the index.html file of the angular project (login/default happens to be the current route viewed in the screenshot):
But it also looks like the plugin's javascript code is being packaged up by angular into the main.js file:
System Info
I'm using
"cordova-plugin-purchase": "^13.9.0",
"@capacitor/android": "^5.0.0",
"@capacitor/core": "^5.0.0",
"@capacitor/app": "^5.0.0",
"@capacitor/cli": "^5.0.0",
"@capacitor/ios": "^5.0.0",
Angular: 13.3.10