Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds many unrelated vue dependencies to the project #361

Open
3 tasks done
Akiyamka opened this issue Aug 5, 2024 · 4 comments
Open
3 tasks done

Adds many unrelated vue dependencies to the project #361

Akiyamka opened this issue Aug 5, 2024 · 4 comments

Comments

@Akiyamka
Copy link

Akiyamka commented Aug 5, 2024

Describe the bug

In case it used in pure node.js app or for example in react app - it unnecessary adds such dependencies as @vue/language-core, @vue/compiler-core, @vue/compiler-dom, batch of @volar/** packages and so on.
Can be fixed by moving next packages to peerDependencies or optionalDependencies

  • "@volar/typescript"
  • "@vue/language-core"
  • "vue-tsc"

Reproduction

not related

Steps to reproduce

pnpm add vite-plugin-dts

System Info

Not related

Validations

@Akiyamka
Copy link
Author

Akiyamka commented Aug 7, 2024

Temporary workaround: in case project uses pnpm you can add next settings in package.json

{
  "pnpm": {
    "packageExtensions": {
      "vite-plugin-dts": {
        "dependenciesMeta": {
          "@volar/typescript": {
            "optional": true
          },
          "vue-tsc": {
            "optional": true
          },
          "@vue/language-core": {
            "optional": true
          }
        }
      }
    }
  }
}

@qmhc
Copy link
Owner

qmhc commented Aug 21, 2024

Are you install the plugin to dependencies but not devDependencies? Dev dependencies will not be packed into the final chunk.

Those packages of Volar are the basic dependencies of the plugin, they are not optional.

@Akiyamka
Copy link
Author

Akiyamka commented Aug 29, 2024

Let me be clear. It's not about final chunk. Such build time deps, regardless of whether is installed in dependencies or devDepenencies, usually not included in a bundle because it's not imported in final application anywhere.

However, if the project does not use vue, these dependencies are simply not used, in other words they are optional and are only needed for a certain tech stack

What's wrong with unnecessary dependencies that will never be used in some projects? I would say it's not a critical problem, but such dependencies cause some inconvenience:

  1. Waste of resources - unnecessary dependencies take up disk space and slow down the overall time it takes to install dependencies.
  2. If you are serious about security, dependencies should be audited and vulnerabilities in them promptly fixed. Adding unused dependencies significantly degrades the DX of those who do it

Thus, making these dependencies optional not only better reflects reality, but will make the users of this wonderful library a little happier ; )

@chris-muller
Copy link

I'd add to some downsides, these Vue dependencies that my project doesn't use caused dependency resolution conflicts because they specify a different version of vue-tsc that some other package is unnecessarily including vue-tsc as a dependency as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants