unplugin/unplugin-vue-components

Why keeping unused?

Barbapapazes opened this issue · 1 comments

Describe the bug

Hello,

This is not really a bug (but I think it is a strange behavior).

I was wondering why, when a component is remove, (which trigger the unlink on the wathcer), it is not remove from the component.d.ts file?

I was suspecting a but I see this test,

it('writeDeclaration - keep unused', async () => {
, so I imagine it's not a bug but I'm not understanding why.

Reproduction

/

System Info

System:
    OS: macOS 14.6.1
    CPU: (8) arm64 Apple M3
    Memory: 93.94 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v20.17.0/bin/npm
    pnpm: 9.9.0 - ~/.nvm/versions/node/v20.17.0/bin/pnpm
  Browsers:
    Chrome: 129.0.6668.91
    Safari: 17.6

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

#611

The issue is that the components in dts are lazily loaded. The plugin doesn't scan the entire app and add them all at once, they get added when they're first loaded. But I recall having an issue where they were getting removed, and then suddenly my intellisense was gone, even though the component wasn't removed from the app. It's just dts files, it doesn't have an impact on anything, so its best to just keep the file continuously growing, or at most shaken off during build runs imo.