Dynamsoft / barcode-reader-javascript

Dynamsoft Barcode Reader JavaScript SDK for package managers. PDF417, QR Code, DataMatrix, MaxiCode and more are supported.
https://www.dynamsoft.com/barcode-reader/sdk-javascript/
Other
169 stars 111 forks source link

Error when importing on Electron #57

Closed akd3vs closed 4 years ago

akd3vs commented 4 years ago

Hello, we are building a PoC for a client that has an application in Electron but we cannot import the module, I've tried different ways to import it but it's always the same error, could you help me?

The error is:

Uncaught TypeError: Cannot read property 'platform' of undefined

Image of the stacktrace: image

Thanks in advance!

Keillion commented 4 years ago

Hi, sorry for that we haven't tried compatibility with electron. I'm looking at it. However, before we done, there might be something you can do to walk around the bug. I haven't test because I need some time to read electron's doc.

If you want dbrjs work in Node.js side:

If you want dbrjs work in browser side.

Things are not so easy. Still working on it.

akd3vs commented 4 years ago

@Keillion Yeah, I tried to define the things it says that were missing. We are trying to use it only as browser.

Thanks for the quick reply!

Keillion commented 4 years ago

@akd3vs Try this: https://github.com/dynamsoft-rd-0/dbrjs-electron In main process, dbrjs works like in a node environment. In renderer process, dbrjs works like in a web environment.

akd3vs commented 4 years ago

@Keillion I think it worked, but now I'm getting this error:

Also, we are using Electron 7, if that helps.

Oh Wait the error is because how we are trying to retrieve the worker. I'll let you know when I've sorted that out.

Yeah, it is working now. When will this be in a release?

Keillion commented 4 years ago

@akd3vs If everything goes well, we will release 7.3.0-v3 in about a week or two.

akd3vs commented 4 years ago

@akd3vs If everything goes well, we will release 7.3.0-v3 in about a week or two.

In the meantime, can we keep using your fork?

Keillion commented 4 years ago

@akd3vs Yes, of course.

yushulx commented 4 years ago

@akd3vs the issue is fixed. Please install the latest version 7.3.0-v4.

Keillion commented 4 years ago

Sample address: https://github.com/dynamsoft-dbr/javascript-barcode/tree/master/example/hybird/electron