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

vue-template-compiler "vue": "file:../.." devDependency breaks installs in yarn "workspaces" environments. #12900

Open
broofa opened this issue Dec 14, 2022 · 0 comments

Comments

@broofa
Copy link

broofa commented Dec 14, 2022

Version

2.7.14

Reproduction link

https://github.com/vuejs/vue/blob/dev/packages/vue-template-compiler/package.json#L29

Steps to reproduce

(Apologies for not providing an actual SSCCE here. I'm hoping this is an obvious enough, "That ain't right!" issue that an actual reproduction case isn't needed. If it is, let me know and I'll put something together.)

What is expected?

The vue dependency should be a normal version string (e.g. Maybe "2.x")

What is actually happening?

It's... not.

Unfortunately, this causes problems with package manager tools like yarn. For example, I stumbled upon this issue because we're using Yarn workspaces. We have one workspace ("vue-2") that depends on vue@2 and another ("vue-3") that depends on vue@3. Normally, yarn install would be smart enough to keep the module trees separate. However, because of the non-standard dependency declaration here, yarn hoists vue-template-compiler into node_modules at the project root alongside the vue@3 dependencies. So when vue-template-compiler tries to load, it pulls in the wrong version of vue.

FWIW (and as a breadcrumb for others who may have this issue), the solution was to add a nohoist directive to the workspaces section of our project's package.json file.

"workspaces":
    "nohoist": [
      "vue-2/vue-template-compiler"
    ],
   "packages": [
      "vue-2",
      "vue-3",
      // ...
    ]
}

Cc @ktsn and @yyx990803 : It looks like this dependency declaration was added in #7918. (commit here since that PR doesn't seem to want to show actual files or commits)

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

1 participant