Skip to content

Commit 099a8d9

Browse files
committed
feat: re-export setZXingModuleOverrides
The BarcodeDetector polyfill fetches a WASM file at runtime from a CDN. That's a problem for offline applications or applications that run in a network with strict CSP policy. As a workaround the polyfill exports a function to configure the WASM file URL. So we re-export the function here. Also, by default the BarcodeDetector polyfill installs itself by setting `globalThis.BarcodeDetector` but only if there is no native support. This is likely not SSR compatible. Also, native support `BarcodeDetector` is inconsistent. For example, Chrome on MacOS does support `BarcodeDetector` but does not support `Blob` inputs, violating the specification. To have a more consistent support we simply always use the polyfill on all platforms. That likely comes as at a performance cost in raw scanning speed on supporting platforms but the download penalty is paid either way. See #354 #353
1 parent 493d4ba commit 099a8d9

File tree

5 files changed

+175
-111
lines changed

5 files changed

+175
-111
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,11 @@ Use kebab-case to reference them in your templates:
167167
#### How to make it work with Vue 2?
168168
169169
Support is dropped but you can downgrade to vue-qrcode-reader v3.* or lower.
170+
171+
#### I get a "Failed to fetch" error at runtime for some Wasm file.
172+
173+
That Wasm file implements the QR code detector.
174+
Unfortunately, it's not very convenient to bundle this file with the package.
175+
So by default we fetch it at runtime from a CDN.
176+
That's an issue for offline applications or applications that run in a network with strict CSP policy.
177+
For a workaround see: https://github.com/gruhn/vue-qrcode-reader/issues/354

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"dist"
3737
],
3838
"dependencies": {
39-
"@sec-ant/barcode-detector": "^0.1.5",
39+
"@sec-ant/barcode-detector": "^1.1.2",
4040
"webrtc-adapter": "^8.2.2"
4141
},
4242
"devDependencies": {

0 commit comments

Comments
 (0)