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

self is not defined

Open ArgekarStudios opened this issue 3 years ago • 6 comments

ReferenceError: self is not defined at Object. (/node_modules/.pnpm/[email protected][email protected]/node_modules/qrcode-vue3/lib/index.js:1:248)

ArgekarStudios avatar Feb 03 '22 11:02 ArgekarStudios

Any update on this? I have the same issue...

waysagency avatar Oct 01 '22 15:10 waysagency

same here on ssr.

wwwDESIGN-basti avatar Dec 12 '22 14:12 wwwDESIGN-basti

Same here. We're running the project locally as an SPA but it'll be SSR when it hits prod. The person who initially did the work has devved it with no issues but when we check out their branch and try to run the project, we see this error.

Katie-Adams avatar Apr 06 '23 08:04 Katie-Adams

I added the following to nuxt.config.ts:

export default defineNuxtConfig({
  plugins: [
    { src: '~/plugins/qrcode-vue3', ssr: false, mode: 'client' },
  ],
  ...
})

While my plugins/qrcode-vue3.ts looks like this:

import QRCodeVue3 from "qrcode-vue3";

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.component("QRCodeVue3", QRCodeVue3);
})

It works for me. I'm guessing it does not work with SSR, but it's good enough for me. (stole solution from here)

KyleSmith0905 avatar May 03 '23 19:05 KyleSmith0905

I added the following to nuxt.config.ts:

export default defineNuxtConfig({
  plugins: [
    { src: '~/plugins/qrcode-vue3', ssr: false, mode: 'client' },
  ],
  ...
})

While my plugins/qrcode-vue3.ts looks like this:

import QRCodeVue3 from "qrcode-vue3";

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.component("QRCodeVue3", QRCodeVue3);
})

It works for me. I'm guessing it does not work with SSR, but it's good enough for me. (stole solution from here)

This looks promising! I'll try and give it a go when I can, thanks :)

Katie-Adams avatar May 04 '23 08:05 Katie-Adams

I noticed it gives a warning. Don't know how to remove it :/

But it does work

KyleSmith0905 avatar May 04 '23 14:05 KyleSmith0905