vue-demi is incompatible with import * as vue from 'vue' statements.
See original GitHub issueDescribe the bug
When using @vueuse/core
or any vue-demi
based package, and a package that has a import * as Vue from 'vue'
statement, There is a blocking error in the console:
isRef is not a function
I tracked it down to the pre-compilation of dependencies tends to disliking the use of import * as ...
in multiple places.
I am going to look into narrowing down the problem and finding a solution. I will start working on a PR.
Reproduction
https://github.com/elevatebart/demi-star
- clone this repo
- install using yarn
- run yarn dev
- open the chrome console
- see the js error
System Info
Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
:
System:
OS: macOS 11.2.3
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 9.27 GB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.16.0 - /var/folders/_h/jmt847vj0l50c9r8gdc_hz8m0000gn/T/fnm-shell-3404715/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.11 - /var/folders/_h/jmt847vj0l50c9r8gdc_hz8m0000gn/T/fnm-shell-3404715/bin/npm
Browsers:
Chrome: 89.0.4389.114
Firefox: 87.0
Safari: 14.0.3
npmPackages:
@vitejs/plugin-vue: ^1.2.1 => 1.2.1
vite: ^2.1.5 => 2.1.5
Used package manager: yarn
Logs
vite:deps Crawling dependencies using entries:
vite:deps /Users/bart/Documents/exp/demi-star/index.html +0ms
vite:resolve 0ms /src/main.ts -> /Users/bart/Documents/exp/demi-star/src/main.ts +0ms
vite:resolve 3ms vue -> /Users/bart/Documents/exp/demi-star/node_modules/vue/dist/vue.runtime.esm-bundler.js +4ms
vite:resolve 0ms ./App.vue -> /Users/bart/Documents/exp/demi-star/src/App.vue +0ms
vite:resolve 1ms @vueuse/core -> /Users/bart/Documents/exp/demi-star/node_modules/@vueuse/core/dist/index.esm.js +3ms
vite:resolve 1ms local-import-star -> /Users/bart/Documents/exp/demi-star/node_modules/local-import-star/import-star.js +1ms
vite:resolve 1ms ./components/HelloWorld.vue -> /Users/bart/Documents/exp/demi-star/src/components/HelloWorld.vue +1ms
vite:deps Scan completed in 37ms: {
vue: '/Users/bart/Documents/exp/demi-star/node_modules/vue/dist/vue.runtime.esm-bundler.js',
'@vueuse/core': '/Users/bart/Documents/exp/demi-star/node_modules/@vueuse/core/dist/index.esm.js',
'local-import-star': '/Users/bart/Documents/exp/demi-star/node_modules/local-import-star/import-star.js'
} +17ms
Pre-bundling dependencies:
vue
@vueuse/core
local-import-star
(this will be run only when your dependencies or config have changed)
vite:resolve 0ms @vue/runtime-dom -> null +0ms
vite:resolve 1ms @vue/runtime-dom -> /Users/bart/Documents/exp/demi-star/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0ms
vite:resolve 0ms @vue/runtime-core -> null +5ms
vite:resolve 0ms @vue/runtime-core -> /Users/bart/Documents/exp/demi-star/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +4ms
vite:resolve 0ms vue-demi -> null +1ms
vite:resolve 0ms vue-demi -> /Users/bart/Documents/exp/demi-star/node_modules/vue-demi/lib/index.esm.js +1ms
vite:resolve 0ms @vue/shared -> null +1ms
vite:resolve 0ms @vue/shared -> /Users/bart/Documents/exp/demi-star/node_modules/@vue/shared/dist/shared.esm-bundler.js +1ms
vite:resolve 0ms @vueuse/shared -> null +1ms
vite:resolve 0ms @vueuse/shared -> /Users/bart/Documents/exp/demi-star/node_modules/@vueuse/shared/dist/index.esm.js +1ms
vite:resolve 0ms vue-demi -> /Users/bart/Documents/exp/demi-star/node_modules/vue-demi/lib/index.esm.js +0ms
vite:resolve 0ms @vue/reactivity -> null +13ms
vite:resolve 1ms @vue/reactivity -> /Users/bart/Documents/exp/demi-star/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js +14ms
vite:deps deps bundled in 47ms +0ms
Context
I found this while trying to use @vue/test-utils
within vitejs in a project using @vueuse/core
.
It is a complicated issue and feels like an esbuild limitation but I hope to find a solution.
Before submitting the issue, please make sure you do the following
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Provide a description in this issue that describes the bug.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top GitHub Comments
I do like the sound of that! I will check right away. This is released as part of 2.3.3 for those who wonder.
Thank you team.
cc @JessicaSachs, for chakra_ui
This is fixed at esbuild. I think it can be closed.