Open Clovel opened 3 years ago
You are not supposed to use it on web.
Use an if
statement:
something like this
if(platform == 'web') return;
// rest of the code
I know that. But simply importing the plugin, registering it, causes the exception. On the contrary, other Capacitor or Cordova plugins catch these exceptions.
We should mimic that behavior for this plugin.
Perhaps doing something like this would be acceptable ?
let codePushInstance: CodePush | null = null;
if(Capacitor.getPlatform() !== 'web') {
codePushInstance = new CodePush();
(window as any).codePush = codePushInstance;
} else {
/* Can't use CodePush without Capacitor */
/* The instance will be null */
}
export const codePush: CodePush | null = codePushInstance;
The downside is that the nullish case should be managed by the developer usign this package.
Description
When debugging or developing an app using a web browser (for example for styling development), CodePush throws an uncaught exception that does not come from the app's source code.
Additional Information
This issue does not happen with other Capacitor plugins that are "mobile-only". A good example is the Firebase notification plugin.
Screenshots
Exception :
Code extract :