Skip to content

Commit

Permalink
fix: add wasm file to build
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Oct 15, 2024
1 parent cf10053 commit 790c33c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
18 changes: 13 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
"vuetify": "^2.7.2",
"winston": "^3.13.0",
"winston-daily-rotate-file": "^5.0.0",
"zwave-js": "^13.9.0"
"zwave-js": "^13.9.0",
"zxing-wasm": "^1.2.15"
},
"devDependencies": {
"@actions/github": "^6.0.0",
Expand Down
15 changes: 13 additions & 2 deletions src/components/custom/QrReader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,25 @@
// and "qr-scanner" defaults to a suboptimal implementation if it is not available.
// The following import makes a better implementation available that is based on a
// WebAssembly port of ZXing:
import { setZXingModuleOverrides } from 'barcode-detector/pure'
import 'barcode-detector/side-effects'
import QrScanner from 'qr-scanner'
import { wait } from '../../lib/utils.js'
import logger from '../../lib/logger'
const log = logger.get('QrReader')
import QrScanner from 'qr-scanner'
import wasmFile from 'zxing-wasm/reader/zxing_reader.wasm?url'
setZXingModuleOverrides({
locateFile: (path, prefix) => {
if (path.endsWith('.wasm')) {
return wasmFile
}
return prefix + path
},
})
export default {
props: {
qrbox: {
Expand Down

0 comments on commit 790c33c

Please sign in to comment.