reactive-qr icon indicating copy to clipboard operation
reactive-qr copied to clipboard

Import errors

Open mcallistertyler opened this issue 5 years ago • 3 comments

Similar to #3 I am getting ./node_modules/reactive-qr/dist/index.js Attempted import error: './qr_decode.worker' does not contain a default export (imported as 'QRWorker')

When running a minimal example. I am using HTTPS.

mcallistertyler avatar Jul 08 '19 08:07 mcallistertyler

Seconded, it's not clear at all how #3 could be suddenly working for anyone.

I haven't had much time to play with it, but the issues I see are:

  • A named ES6 import of "./qr_decode.worker" will not work (potentially without some other interpreting happening for magical compatibility in your workflow, Babel?)
  • Along those lines, defining new QRWorker() also should not work without magical compatibility processing.

I haven't had much time to test, but it seems the following changes to index.js solve the problem:

Remove:

import QRWorker from './qr_decode.worker';

Change:

this.webWorker = new QRWorker();

to:

this.webWorker = new Worker('qr_decode.worker.js');

If I have time, I'll throw together a very small PR for this, but please don't wait up for it.

joshgentry avatar Jul 10 '19 09:07 joshgentry

Installed the package from npm and I'm having the exact same issue.

jorgeserras avatar Sep 29 '19 20:09 jorgeserras

I'm having the same issues. Running react 16.8.4

mm420admin avatar Nov 03 '19 21:11 mm420admin