wheatjs / vite-plugin-vue-type-imports

Import types in Vue SFC for defineProps
223 stars 17 forks source link

still error #2

Closed hi-reeve closed 2 years ago

hi-reeve commented 2 years ago

after the first fix on #1 it does work on the vite config. but when i try to import a props type from different file i still got an error

image

Component

import { Props } from './Pagination';
const props = withDefaults(defineProps<Props>(), {
    currentPage: 1,
    perPage: 10,
    paginationSize: 5,
    rangeSize: 1,
    hideSkipButton: false,
});

Pagination.ts

export interface Props {
    currentPage: number;
    paginationSize?: number;
    perPage?: number;
    rangeSize?: number;
    total: number;
    hideSkipButton?: boolean;
}
wheatjs commented 2 years ago

😬 Sorry about that. Could you provide a minimal reproduction? I haven't been able to reproduce this myself

hi-reeve commented 2 years ago

hey! sorry for the late reply, been busy with stuff here is my branches repo.

https://github.com/zynth17/vitailse/tree/bug-vite-plugin-vue-type-import

wheatjs commented 2 years ago

Are you getting that error in your repo? I pulled it and ran it with the <HelloWorld /> component and didn't run into any errors? Can I ask what platform you are on?

hi-reeve commented 2 years ago

Are you getting that error in your repo? I pulled it and ran it with the <HelloWorld /> component and didn't run into any errors? Can I ask what platform you are on?

yes in that repo im getting the error as well basically it just doesn't work in my machine. i'm currently on windows 11.

hi-reeve commented 2 years ago

hello, any update on this?

wheatjs commented 2 years ago

Sorry for the delay, I've been pretty busy recently. I'll try to get a fix out this weekend!

hi-reeve commented 2 years ago

thankyou so much!

DannyFeliz commented 2 years ago

Just tried and I'm getting this error too

wheatjs commented 2 years ago

Sorry it took so long, should be fixed in v0.0.3

hi-reeve commented 2 years ago

image

still got the same error even after upgrading to v0.0.3. can you re open this?

wheatjs commented 2 years ago

Can you provide a reproduction for that? It works in the original reproduction you provided

hi-reeve commented 2 years ago

Can you provide a reproduction for that? It works in the original reproduction you provided

weirdly it does work on my reproduction i provided. here's the reproduction on stackblitz https://stackblitz.com/edit/vitejs-vite-c5b9xa?file=src/components/HelloWorld.vue

wheatjs commented 2 years ago

Take a look at this https://stackblitz.com/edit/vitejs-vite-xz3znc?file=src%2Fcomponents%2FHelloWorld.vue

I forked your stackblitz and installed the plugin in the vite.config.ts file and it works. Maybe you forgot to do that?

hi-reeve commented 2 years ago

Take a look at this https://stackblitz.com/edit/vitejs-vite-xz3znc?file=src%2Fcomponents%2FHelloWorld.vue

I forked your stackblitz and installed the plugin in the vite.config.ts file and it works. Maybe you forgot to do that?

oh sorry i forgot to do it on the reproduction. and no i did not forget it on my project. i will try it once again and will tell you afterwards. thankyou.

wheatjs commented 2 years ago

@zynth17 I just did a big update to the plugin, maybe you could update to the latest version and see if it works for you now

hi-reeve commented 2 years ago

@zynth17 I just did a big update to the plugin, maybe you could update to the latest version and see if it works for you now

the new version works! thankyou so much!

cizkey commented 2 years ago

https://stackblitz.com/edit/vitejs-vite-xz3znc?file=src%2Fcomponents%2FHelloWorld.vue

@zynth17 i try to run your demo with '0.1.2', but it still error. i only modify some lib version. image

while when i changed the versiono '0.0.3' , the demo run work fun! image

@wheatjs can you help me?

wheatjs commented 2 years ago

It looks like it is a problem with adding an extension to the import. Replace import { Props } from '../types/HelloWorld.ts' with import { Props } from '../types/HelloWorld'.

I'll see if I can get a fix out for this tomorrow, thanks!

wheatjs commented 2 years ago

@cizkey solution above in case you didn't get the notification since this issue is closed 🤔

cizkey commented 2 years ago

@cizkey solution above in case you didn't get the notification since this issue is closed 🤔

thanks , i knew it.

wheatjs commented 2 years ago

@cizkey Should be fixed in version 0.1.3