Skip to content

The retrieved Vue version number is incorrect. #767

Closed
@wkeylin

Description

@wkeylin

Describe the bug

The main Vue 2 project at /project/ and a Vue 3 based docs subdirectory at /project/docs
getVueVersion will return wrong version because of this issue unjs/mlly#158

function getVueVersion(root: string): 2 | 2.7 | 3 {
const raw = getPackageInfoSync('vue', { paths: [root] })?.version || '3'
const version = +(raw.split('.').slice(0, 2).join('.'))
if (version === 2.7)
return 2.7
else if (version < 2.7)
return 2
return 3

Reproduction

https://github.com/wkeylin/mlly-demo

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1 Pro
    Memory: 96.22 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.2.0 - ~/.volta/tools/image/node/22.2.0/bin/node
    Yarn: 1.22.19 - ~/.volta/bin/yarn
    npm: 10.7.0 - ~/.volta/tools/image/node/22.2.0/bin/npm
    pnpm: 8.15.8 - ~/.volta/tools/image/pnpm/8.15.8/bin/pnpm
  Browsers:
    Chrome: 125.0.6422.142
    Safari: 17.5

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions