Skip to content

Commit 12e544c

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 12e544c

File tree

4 files changed

+167
-111
lines changed

4 files changed

+167
-111
lines changed

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)