ionic-team / capacitor-barcode-scanner

https://capacitorjs.com/docs/apis/barcode-scanner
MIT License
14 stars 14 forks source link

Working in PWA #28

Open impronta48 opened 1 month ago

impronta48 commented 1 month ago

I've developed a simple app using the barcode-scanner.

It works in developer mode, but as soon as I switch to production mode i get

[Scanner Web Error] QR code parse error, error = l: No MultiFormat Readers were able to detect the code.

The workaround that I found was to set in angular.js

"production": {
....
              "optimization": {
                "scripts": false,
                "styles": true
              }
}

But I don't like it. Any idea of what might be tree-shaked and how to avoid it?

stlbpw commented 3 weeks ago

@impronta48 Did you get the barcode scanner working on a mobile device as a PWA?

impronta48 commented 3 weeks ago

yes, it works easily. I had some problems when compiling on Android, but I solved removing the optimizations

loic-parent commented 4 days ago

Hello,

I'm trying to use this package in my Ionic webapp project too.

It seems to "work" but the scanner does not stay. It opens, scan and close directly with an error: QR code parse error, error = No barcode or QR code detected.

https://github.com/user-attachments/assets/17c754a1-34a7-4d22-87c0-da4562194255

I only have a new created ionic project (using Angular Standalone) with only this package and this configuration:

const result = await CapacitorBarcodeScanner.scanBarcode({
    hint: 0,
    cameraDirection: 1
});

console.log(result);

Can someone help me with this?

Thanks, Loïc

loic-parent commented 4 days ago

Is this package compatible with WEV Plateform or this is only for IOS and Android?

Thanks, Loïc