I have followed the docs here, https://capacitor.ionicframework.com/docs/plugins/ and made a plugin.
Is there any way I can use this plugin without publishing it to npm? How can I locally add a capacitor plugin
I have followed the docs here, https://capacitor.ionicframework.com/docs/plugins/ and made a plugin.
Is there any way I can use this plugin without publishing it to npm? How can I locally add a capacitor plugin
I havenāt tried it with a Capacitor plugin, but generally you can install local packages with npm install <folder>
, where <folder>
is a local folder on your machine. See https://docs.npmjs.com/cli/install
I also didnāt use Capacitor but with Cordova this is possible via ionic cordova <path-to-folder>
. I think this should be possible with the Capacitor command too.
Hello,
Iām having problems with this too. How did you develop your custom plugin in a real Ionic project?
Iām trying to develop a custom Capacitor plugin in a directory called ālocal_modulesā similar to ānode_modulesā but, after installing it with npm install <path to module>
, I get the following error when importing:
Cannot find module āmodule-nameā.ts(2307)
Thanks,
Did you build the plugin? Run npm build
in the local capacitor plugin folder, then try installing it. It worked for me.
Thank you! That was the problem. When running npm build
some additional files are generated and then it works.
You can also use the npm link
function in npm.