vite-plugin-vue-devtools icon indicating copy to clipboard operation
vite-plugin-vue-devtools copied to clipboard

DX: The type of the ui-kit component could not be resolved.

Open Jannchie opened this issue 2 years ago • 2 comments

I am learning the monorepo architecture of this library. I found that components in the ui-kit are resolved to any type.

I found that this could be caused by the exports field in ui-kit's package.json (delete this field and add /dist/ in the path in the resolver.ts will work).

I'm still learning and haven't found a solution yet. I've posed an issue(https://github.com/vitejs/vite-plugin-vue/issues/252) for the moment, but wondered if you have an elegant solution?

Jannchie avatar Sep 11 '23 04:09 Jannchie

Commonly we do not care about these, because we use unplugin-vue-components to auto change/add the import path in compile time.

see this

alexzhang1030 avatar Sep 11 '23 07:09 alexzhang1030

Commonly we do not care about these, because we use unplugin-vue-components to auto change/add the import path in compile time.

While this generates the type definition file correctly, it doesn't resolve to the vue file correctly. This leads to missing type definitions at development time, even though the components can be imported.

The solution is that the consumer needs to define the paths alias in tsconfig.json.

Jannchie avatar Sep 11 '23 09:09 Jannchie