You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When I use Capacitor with bundledWebRuntime enabled, installed Plugins aren't automatically registered. Only after the plugin is required it gets registered. So you can't use Capacitor.Plugins.MyPlugin directly, as if you're using the Android or iOS platform. You've to use require("my-plugin") first.
To Reproduce
Create a new basic app: npm init @capacitor/app
Add the Electron platform: npm i @capacitor-community/electron and npx cap add @capacitor-community/electron
Install the Dialog plugin: npm install @capacitor/dialog, npx cap sync and npx cap sync @capacitor-community/electron
Run the Electron app: npx cap open @capacitor-community/electron
Enter the following code into the console and you'll get an Uncaught TypeError error: Capacitor.Plugins.Dialog.alert({ title: 'Test', message: 'This is a test', });
Enter require('@capacitor/dialog');, repeat the above code and now it works.
Expected behavior
You shouldn't have to extra require the plugin.
The text was updated successfully, but these errors were encountered:
hampoelz
changed the title
Plugins are not autoregistered with bundledWebRuntime
Plugins aren't auto registered with bundled Capacitor Core
Jul 17, 2021
The same problem exists for plugins with electron support. CapacitorElectronPlugins.MyPlugin works fine, but Capacitor.Plugins.MyPlugin returns undefined. If the packed version of the plugin is installed (with npm pack and npm install ../path/to/my-plugin/my-plugin-0.1.0.tgz) and you require the plugin now, the web implementation will be loaded. If you install the unpacked plugin with npm install ../path/to/my-plugin, the Electron implementation will be loaded.
Describe the bug
When I use Capacitor with
bundledWebRuntime
enabled, installed Plugins aren't automatically registered. Only after the plugin isrequired
it gets registered. So you can't useCapacitor.Plugins.MyPlugin
directly, as if you're using the Android or iOS platform. You've to userequire("my-plugin")
first.To Reproduce
npm init @capacitor/app
npm i @capacitor-community/electron
andnpx cap add @capacitor-community/electron
npm install @capacitor/dialog
,npx cap sync
andnpx cap sync @capacitor-community/electron
npx cap open @capacitor-community/electron
Uncaught TypeError
error:Capacitor.Plugins.Dialog.alert({ title: 'Test', message: 'This is a test', });
require('@capacitor/dialog');
, repeat the above code and now it works.Expected behavior
You shouldn't have to extra
require
the plugin.The text was updated successfully, but these errors were encountered: