Build errors with vite
JasonMan34 opened this issue · comments
Installing (and importing) this package on a clean vue-vite project with typescript causes build errors
Cannot find module 'vue/types/options' or its corresponding type declarations
Cannot find name 'Vue'.
Cannot find module '@vue/composition-api' or its corresponding type declarations.
Relevant dependencies:
{
"scripts": {
"build": "vue-tsc --noEmit && vite build",
},
"dependencies": {
"chart.js": "^3.6.0",
"vue": "^3.2.16",
"vue-chart-3": "^0.5.10"
},
"devDependencies": {
"@vitejs/plugin-vue": "^1.9.3",
"typescript": "^4.4.3",
"vite": "^2.6.4",
"vue-tsc": "^0.3.0"
}
}
Minimal reproduction repo - https://github.com/JasonMan34/vite-vue-chart-3-bug
@JasonMan34 No problem for me when running it on codesandbox. What package manager do you use ?
Sandbox: https://codesandbox.io/s/vibrant-shannon-8ezs3?file=/package.json
If you have a tsconfig.json
, add skipLibCheck:true
and reference it in your vue-tsc script. The types comes from vue-demi
I will look into this! Can you try npx vue-demi-switch 3
?
Didn't change anything :x
Can you try 0.5.11? Should be fixed :D
@JasonMan34 Can you try 0.6.0-alpha.6
? I prioritized vue 3 types on this version and kept 0.5.x
version for vue 2 compatible types. If you are using Volar, you should have type check and autocompletion in props :)
Yayyy, the last type error is fixed in 0.6.0-alpha.7 ! Thanks for being reactive :D
Thanks for making the package ^^
But I'm still getting the error in utils.d.ts
in 0.6.0-alpha.7 😅
I think the basis of all these errors comes from the fact that when running npm install on this repo (on vue-chart-3 that is), vue 2 gets installed, rather than vue 3, so some typings break when used in a vue 3 project
Would replacing Vue
with ComponentPublicInstance
be a good solution here?
Any word on this?
Should be fixed with new version!
Works fine now, thanks for the support!