question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: extending PluginRegistry doesn't work like stated in the docs

See original GitHub issue

Description of the problem:

According to the “TypeScript Interface” section of https://capacitor.ionicframework.com/docs/plugins/, it should be possible to merge additional custom Plugins into the PluginRegistry interface:

declare module '@capacitor/core' {
	interface PluginRegistry {
		Echo: EchoPlugin;
	}
}

However this does not work, the type doesn’t get merged in:

Instead, the module has to be declared as @capacitor/core/dist/esm/core-plugin-definitions:

declare module '@capacitor/core/dist/esm/core-plugin-definitions' {
	interface PluginRegistry {
		Echo: EchoPlugin;
	}
}

TBH I don’t exactly understand why the first version doesn’t work, because dist/esm/index.d.ts exports everything from ./core-plugin-definitions 🤷🏻‍♂️


Affected platform

  • Android
  • iOS
  • electron
  • web

OS of the development machine

  • Windows
  • macOS
  • linux

Capacitor version: beta.25

node version: 10.x

npm version: 6.4

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:14
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
swernimocommented, Feb 23, 2021

I ran into this same issue. Here’s my Ionic Info.

Screen Shot 2021-02-23 at 4 19 33 PM

For me it was the order of imports. I was importing Plugins before I was importing the custom plugin. Lost about half a day before I found this thread.

1reaction
unitree-czkcommented, Jan 11, 2020

@simonhaenisch I find a method for instance import “capacitor-udp” import { Plugins } from “@capacitor/core”;

import the additional package before and you can find your plugin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The following method did not exist: 'org.springframework ...
Cause. When this error is displayed: The following method did not exist: 'org.springframework.plugin.core.PluginRegistry ...
Read more >
Docker network driver plugins
Docker Engine network plugins enable Engine deployments to be extended to support a wide range of networking technologies, such as VXLAN, IPVLAN, MACVLAN...
Read more >
San Diego Patch 2 - ServiceNow Docs
Actual behavior: The data pill is shown as 'undefined'. Flow Designer. PRB1566858. Email trigger flows do not run after upgrade to San Diego ......
Read more >
Variant Effect Predictor Download and install - Ensembl
2 to run VEP, and installing cpanm to handle the installation of perl modules. These steps can be completed with the commands: perlbrew...
Read more >
Supporting the new Android plugins APIs | Flutter
As of the 1.12 release, new plugin APIs are available for the Android platform. The old APIs based on PluginRegistry.Registrar won't be immediately ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found