Calling plugin while using Capacitor as Script include for PWA #3174
-
Hi Folks, However, when I call this: Camera.getPhoto(); It fails with: app.js:92 Uncaught ReferenceError: Camera is not defined also tried : Plugins.Camera.getPhoto(); with same result So somehow the Plugins are not being included into capacitor.js or I am referencing them wrong. Please note that I am not calling import anywhere, relying on script include to include plugins capacitor.js is minified, so rather hard to read. Not a lot of examples for the "Script include" way of doing things. I am not using Ionic in this case, I am using Framework7. I did all the steps in this set of instructions :
Thanks in advance for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 8 replies
-
Hey Mark, my guess is that you're not including PWA Elements, which is required for the Camera to work in a PWA. Here's the script tag details. |
Beta Was this translation helpful? Give feedback.
-
Ah, I see now. My index.html does have a
|
Beta Was this translation helpful? Give feedback.
-
I assume you are referring to this section of the installation doc
|
Beta Was this translation helpful? Give feedback.
-
Thank you!
…On Tue, Jun 30, 2020 at 11:55 AM Matt Netkow ***@***.***> wrote:
Oh sorry! Looks like GitHub stripped out the head tag mention. oops!
Trying to build this example out now, stay tuned.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3174 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA6AV72EGIHT5LOLSO7A3PTRZIKHPANCNFSM4OLR6VDA>
.
|
Beta Was this translation helpful? Give feedback.
-
OK, here's a working example in one HTML file. You can open this on the file system or via The docs here are most of the way there - I will update soon but in the meantime, here's a WIP full example (subject to change!) You must include the
|
Beta Was this translation helpful? Give feedback.
OK, here's a working example in one HTML file. You can open this on the file system or via
npx cap serve
(local web server).The docs here are most of the way there - I will update soon but in the meantime, here's a WIP full example (subject to change!)
You must include the
capacitor.js
file locally. It can be found undernode_modules/@capacitor/core/dist/capacitor.js
or will get copied into your project automatically from there by running thenpx cap copy web
command (as the docs mention).