ElMassimo / iles

šŸ The joyful site generator
https://iles.pages.dev
MIT License
1.06k stars 31 forks source link

3rd-party components with "Layout" in the name generate incorrect import paths in `components.d.ts` #235

Closed rsek closed 1 year ago

rsek commented 1 year ago

Description šŸ“–

So far I've been able to reproduce this with both Vuetify (VLayout) and Inkline (ILayout). This is with the appropriate resolvers (Vuetify3Resolver, InklineResolver) from unplugin-vue-components/resolvers.

// iles.config.ts
import { defineConfig } from 'iles'
import { Vuetify3Resolver } from 'unplugin-vue-components/resolvers'

export default defineConfig({
    vite: {
        ssr: { noExternal: ['vuetify'] }
    },
    components: {
        dirs: ['src/components', 'node_modules/vuetify'],
        resolvers: [Vuetify3Resolver()]
    }
})
 // components.d.ts
declare module '@vue/runtime-core' {
  export interface GlobalComponents {
    // ...
    VLayout: typeof import('./src/layouts/v.vue')['default'] // expected: typeof import('vuetify/components')['VLayout']
    // ...
    VList: typeof import('vuetify/components')['VList']
    VListItem: typeof import('vuetify/components')['VListItem']
    VNavigationDrawer: typeof import('vuetify/components')['VNavigationDrawer']
  }
}

Reproduction šŸž

Available here. This reproduces it with Vuetify, but the same pattern is apparent with Inkline's ILayout, where it points to src/layouts/i.vue instead of src/layouts/v.vue.

Dependencies Info _Run `npx iles info` and `pnpm list` (or `npm list`) and provide the output:_ `npx iles info`: `iles v0.9.2 vite v4.1.4` `npm list`: ``` iles-layout-bug@0.0.0 /home/rsek/Development/GitHub/iles-layout-bug-repro ā”œā”€ā”€ iles@0.9.2 ā”œā”€ā”€ npm@9.5.1 ā”œā”€ā”€ sass@1.58.3 ā”œā”€ā”€ typescript@4.9.5 ā”œā”€ā”€ vite@4.1.4 ā”œā”€ā”€ vue-tsc@0.38.9 ā””ā”€ā”€ vuetify@3.1.6 ```
ElMassimo commented 1 year ago

Thanks for reporting @rsek, and for providing a minimal reproduction!

Fixed in iles@0.9.4.

rsek commented 1 year ago

Great, thanks for the fix! :) :rocket: