vue-qrcode-component icon indicating copy to clipboard operation
vue-qrcode-component copied to clipboard

vue 3 + vite compatable?

Open popnoodles opened this issue 1 year ago • 3 comments

npm install vue-qrcode-component import VueQRCodeComponent from 'vue-qrcode-component';

Produces:

Uncaught SyntaxError: The requested module '/node_modules/qrcode-js-package/qrcode.js?v=c0063e26' does not provide an export named 'default' (at QRCode.vue:7:12)

popnoodles avatar Jul 02 '23 20:07 popnoodles

Following...

webgurumike avatar Jul 07 '23 17:07 webgurumike

Hi, it seems there is something incompatible with new vue 3.

I created a new vue-app "vue": "^3.3.4" after installing "vue-qrcode-component": "^2.1.1" with yarn add

the following error rise:

Cannot find module 'vue-qrcode-component' or its corresponding type declarations.ts(2307)

js console:

Uncaught SyntaxError: The requested module '/node_modules/qrcode-js-package/qrcode.js?v=6f1bdf41' does not provide an export named 'default' (at QRCode.vue:7:12)

main.ts

import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import VueQRCodeComponent from 'vue-qrcode-component' // error here

import App from './App.vue'
import router from './router'


const app = createApp(App)

app.component('qr-code', VueQRCodeComponent)
app.use(createPinia())
app.use(router)

app.mount('#app')

maguri avatar Jul 08 '23 08:07 maguri

Hi,

This component was developed for the first version of Vue and it was still compatible with Vue2. I've recently started to get into Vue again and learning the changes in Vue3, so I will take a look into this as soon as possible.

@maguri Thank you for all that information, it will help troubleshooting 😃

gerardreches avatar Jul 11 '23 16:07 gerardreches