Follow the information here: https://capacitorjs.com/docs/plugins/web I have created the default capacitor plugin with the echo
method. Inside of the vue file, I have the following:
import { Plugins } from '@capacitor/core';
import 'my-bluetooth-plugin';
…
async echoDevice() {
const { MyBluetooth } = Plugins;
await MyBluetooth.echo({ value: 'test' });
}
Note: I was unable to run npm link
in the plugin folder and then npm link my-bluetooth-plugin
and npm install my-bluetooth-plugin
as noted here https://capacitorjs.com/docs/plugins/workflow as it simply doesn’t work or do anything. Simon Grimm also ran into the same issue in this video (set to the second he talks about it) and had a workaround of doing npm install ../my-bluetooth-plugin
instead. Doing so has caused another error which I believe to be related to the build process:
Module build failed (from ./node_modules/eslint-loader/index.js):
Error: No ESLint configuration found in /Users/username/Projects/my-bluetooth-plugin/dist/esm.
at CascadingConfigArrayFactory._finalizeConfigArray (/Users/username/Projects/my-mobile-app/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:432:19)
at CascadingConfigArrayFactory.getConfigArrayForFile (/Users/username/Projects/my-mobile-app/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:271:21)
at CLIEngine.isPathIgnored (/Users/username/Projects/my-mobile-app/node_modules/eslint/lib/cli-engine/cli-engine.js:951:18)
at CLIEngine.executeOnText (/Users/username/Projects/my-mobile-app/node_modules/eslint/lib/cli-engine/cli-engine.js:868:38)
at lint (/Users/username/Projects/my-mobile-app/node_modules/eslint-loader/index.js:278:17)
at transform (/Users/username/Projects/my-mobile-app/node_modules/eslint-loader/index.js:252:18)
at /Users/username/Projects/my-mobile-app/node_modules/loader-fs-cache/index.js:127:18
at ReadFileContext.callback (/Users/username/Projects/my-mobile-app/node_modules/loader-fs-cache/index.js:31:14)
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:237:13)
Please help either with the npm link or the eslint issue. I’ll take either at this point!