I am developing a Capacitor plugin (local) for personal use and followed these steps:
- Generated a plugin via npm init @capacitor/plugin [options] etc. (this worked fine)
- npm install --save …/pathtomyplugin (local path)
- npx cap sync
So far so good …
Package sits in the package.json (“capacitor-plugin-unlocks”: “file:…/capacitor-plugin-unlocks”,)
But when I try to build my ionic android project with:
ionic capacitor sync android / or ionic build
I get this:
This dependency was not found:
- capacitor-plugin-unlocks in ./node_modules/cache-loader/dist/cjs.js??ref–12-0!./
My plugin is still in development and is not published on NPM.
How do I get this to work? (I am working within an ionic vuejs project)
*update:
I discovered that the folder in ./node-modules is only a link/shortcut to the other path … it does not actually copy the files over. I tried npm link as well but without success.
Manually copying the plugin into node modules does not help either
**update:
So far I discovered that it is a VueJS CLI specific error message.
I import the plugin as follows in my Vue project
import { UnlocksPlugin } from ‘capacitor-plugin-unlocks’;
If I remove this line it will build just fine.
Somehow the local capacitor plugin I created cannot be imported in my Vue project. Regardless is sitting in node_modules and my package.json