unable to import type in vue sfc ffrom same package #9883
|
Hi i have a vue component library where when i am trying to build a component during type script compilation my package is unable to load types from same package i am getting error |
Replies: 1 comment
|
Sorry for the very late reply here. This was a real bug in our Vue SFC compiler, and it has since been fixed. When you use Current versions pass the full path, and there is now a regression test covering exactly this case. I re-ran your scenario on the current stack (bit 2.2.8 with If you are still hitting this, update the env and reinstall: If it persists after that, check that the type file is actually tracked as part of the component ( |

Sorry for the very late reply here.
This was a real bug in our Vue SFC compiler, and it has since been fixed.
When you use
defineProps<T>()withTimported from another file,@vue/compiler-sfcresolves that import relative to the filename it is handed. Our compiler was passing only the relative filename instead of the full path, so Vue looked for./typesrelative to the working directory rather than next to your component, and reportedFailed to resolve import source "./types".Current versions pass the full path, and there is now a regression test covering exactly this case. I re-ran your scenario on the current stack (bit 2.2.8 with
bitdev.vue/vue-env) and it compiles fine, with props a…