gerardreches / vue-qrcode-component

Create QR codes with a simple Vue component
https://gerardreches.github.io/vue-qrcode-component/
MIT License
124 stars 21 forks source link

vue 3 + vite compatable? #19

Open popnoodles opened 1 year ago

popnoodles commented 1 year ago

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)

webgurumike commented 1 year ago

Following...

maguri commented 1 year ago

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')
gerardreches commented 1 year ago

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 😃