vueuse / vue-demi

🎩 Creates Universal Library for Vue 2 & 3
MIT License
3.01k stars 158 forks source link

error when Vite HMR #116

Closed webszy closed 2 years ago

webszy commented 3 years ago

my Code on main.js this is my repo: https://github.com/webszy/vite-vue2-project

import { createApp, h, install } from "vue-demi"
install()

i have run the npx vue-demi-switch 2,and i find out install doesn't work. image

if i import vue-composition-api again,the error changed image

my system information

System:
    OS: Windows 10 10.0.19043
    CPU: (4) x64 Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz
    Memory: 5.93 GB / 15.94 GB
  Binaries:
    Node: 14.18.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 7.24.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 95.0.4638.69
    Edge: Spartan (44.19041.1266.0), Chromium (95.0.1020.40)
    Internet Explorer: 11.0.19041.1202
  npmPackages:
    @vitejs/plugin-legacy: ^1.6.2 => 1.6.2
    vite: ^2.6.13 => 2.6.13
    vue-demi: ^0.12.0 => 0.12.0
antfu commented 3 years ago

Make sure you are on latest version of both vue-demi and @vue/composition-api and there are only one version installed in your node_modules

webszy commented 3 years ago

sorry to replay so late. I tried your answer,remove the @vue/composition-api I installed, and update the vue-demi to latest. error still showing. you can see my repo: https://github.com/webszy/vite-vue2-project vue.runtime.esm.js:619 [Vue warn]: Error in data(): "Error: [vue-composition-api] must call Vue.use(VueCompositionAPI) before using any function."

watonyweng commented 3 years ago

@webszy Of course, you'd need to install @vue/composition-api or vue@next

webszy commented 3 years ago

@webszy Of course, you'd need to install @vue/composition-api or vue@next

好了,用中文给你说,我想弄个vue2的脚手架,目前看装不装@vue/composition-api都会有错,如果去掉vue-demi这个库就没这个问题了

webszy commented 2 years ago

disappoint for this and give up to use this package

antfu commented 2 years ago

Feel free to.