react-barcode-reader icon indicating copy to clipboard operation
react-barcode-reader copied to clipboard

Vite.js incompatibility

Open molaux opened this issue 1 year ago • 2 comments

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.

molaux avatar Dec 23 '23 11:12 molaux

Does this work for you?

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

LucidityDesign avatar Jan 28 '24 08:01 LucidityDesign

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

satyam-veris avatar Apr 28 '24 19:04 satyam-veris