zxing-js / browser

ZXing for JS's browser layer with decoding implementations for browser.
MIT License
213 stars 43 forks source link

[Improvement] Tree shaking bundle #107

Open Roman991 opened 1 year ago

Roman991 commented 1 year ago

This is the code


import { BarcodeFormat, DecodeHintType } from '@zxing/library';
import {
    BrowserCodeReader,
    IScannerControls,
    BrowserMultiFormatReader,
} from '@zxing/browser';

const hints = new Map();
const formats = [
    BarcodeFormat.EAN_13,
    BarcodeFormat.EAN_8,
    // BarcodeFormat.CODABAR,
];
hints.set(DecodeHintType.POSSIBLE_FORMATS, formats);
const codeReader = new BrowserMultiFormatReader(hints);
this.controls = await codeReader.decodeFromVideoDevice(
....
);

image And this is the import size 1.2MB, Idk if its more related to this or to the parent library

myasul commented 1 year ago

I also have this problem. Is it possible to reduce the bundle size? This is the biggest package I have on my app.

image