wheatjs / vite-plugin-vue-type-imports

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

Can't support default index.ts file #8

Closed cizkey closed 2 years ago

cizkey commented 2 years ago

i use it in simple demo, it working fine, but when i used in my project, it still occured an error.

i write an reproduce demo:
https://stackblitz.com/edit/vitejs-vite-7gvmeo?file=src%2Fcomponents%2Fcontext-menu%2FMenuItem.vue

the error msg as follow: image

i have no idea that what caused, really need your help, thanks.

cizkey commented 2 years ago

i found that the error is occur because Plugin can not recognize the index.ts

like this:

import { IMenuItem } from '../typings'

In fact the interface IMenuItem defined in /typings/index.ts,

image

when i use below import code , it working fine.

import { IMenuItem } from '../typings/index`

image

it seems Plugin can not figure out default index.ts in directory, or a file has no extensions.

Will you support this feature ?

wheatjs commented 2 years ago

Fixed in latest release, thanks!