svelte-qrcode icon indicating copy to clipboard operation
svelte-qrcode copied to clipboard

[BUG] Cannot set properties of undefined

Open netcodedev opened this issue 2 years ago • 7 comments

When trying to use your library i get the following error:

Cannot set properties of undefined (setting 'QRious')
TypeError: Cannot set properties of undefined (setting 'QRious')
    at /node_modules/svelte-qrcode/src/lib/qrcode/index.js:22:20
    at /node_modules/svelte-qrcode/src/lib/qrcode/index.js:23:4

I am running sveltekit next with svelte version ^3.49.0 on vite ^3.0.7

netcodedev avatar Aug 15 '22 12:08 netcodedev

I got the same error. Looking forward to solutions

don-wang avatar Sep 06 '22 00:09 don-wang

Same issue here...

d3signicp avatar Sep 10 '22 14:09 d3signicp

Me too

Arpan-206 avatar Oct 15 '22 14:10 Arpan-206

The same error occurred for me. Cannot set properties of undefined (setting 'QRious')

I found this site. https://github.com/phippsytech/svelte-qrious

However, it is still not resolved.

jungsangun avatar Nov 30 '22 12:11 jungsangun

+bump

celldra avatar Feb 04 '23 09:02 celldra

One of the workaround is you can try to dynamically import the component to load it in your svelte page like this:

// QRcomponent.svelte
<script>
  import QrCode from 'svelte-qrcode';
  export let url;
</script>

<QrCode value="{url}" />
// yourapp.svelte
<script>
let QRcomponent;
onMount(async () => {		
  try { 
      QRcomponent = (await import('./QRcomponent.svelte')).default;
    } catch (e) { 
      // do some thing
    } 
  });
</script>

<svelte:component this={QRcomponent} url={mainQuizUrl}/>

tobive avatar Apr 08 '23 03:04 tobive

Hello, I am developing a new version of the package; I will bring updates soon.

JonasJs avatar Jan 10 '24 12:01 JonasJs