kybarg / react-barcode-reader

React component for reading barcode an QR codes from devices that are represented as keyboard to the system.
MIT License
86 stars 34 forks source link

Vite.js incompatibility #42

Closed molaux closed 6 months ago

molaux commented 11 months ago

Hello,

I can not use your package with Vite.js since it expects package.json's "module" field to be a path to an es module.

It should be "type": "commonjs" instead I think.

[vite] Pre-transform error: Failed to resolve entry for package "react-barcode-reader". The package may have incorrect main/module/exports specified in its package.json.

This link could be usefull.

LucidityDesign commented 9 months ago

Does this work for you?

// @ts-expect-error
import BarcodeReader from 'react-barcode-reader/lib/index'
satyam-veris commented 6 months ago

Does this work for you?

// @ts-expect-error
import BarcodeReader from 'react-barcode-reader/lib/index'

I got a new error

Uncaught SyntaxError: The requested module '/node_modules/react-barcode-reader/lib/index.js?v=cdab873b' does not provide an export named 'default'

Also tried adding exports [referring to this PR] in the package.json of this lib in the node_modules but getting same error

smoelker commented 5 days ago

Was this issue actually fixed and released? I also get this error on version 0.0.2 of the package.