Closed fudom closed 8 months ago
Hi @fudom
Cordova plugins are not directly included via ES6 imports however. The javascript itself is automatically packed in via the cordova CLI tool, so attempting to directly include like this would likely just create a duplicate import and possibly some plugin confusion.
I generally reference these via triple-slash directives:
/// <reference types="cordova-plugin-ble-central" />
You can also add these to the types
collection in your tsconfig.json
instead if you prefer: https://www.typescriptlang.org/tsconfig#types
Some related discussion at https://github.com/apache/cordova-plugin-file/issues/400#issuecomment-648731239
Curiously, adding it to types
didn’t work in my repo. But the reference-comment works. Not my preferred solution, but it's fine since I only need it in one file. Thanks 👍
I get an error during build when
No error in VSCode. But the Angular build throws:
Has anyone tested this? I'm not sure what's wrong in my tsconfig.json. Great that types are present. But I would add this to the docs or fix that. It seems that the types.d.ts extends
window
withble
. It's not a module. Fine, but why this error? The package.json looks ok. I'm currently exhausted and appreciate any hint.