Skip to content

Monorepo packages detection logic does not match npm #2201

Description

@limzykenneth

Describe the bug

For npm workspaces based monorepo projects, it seems the logic used to detect available packages within the monorepo does not fully match npm. Specifically, in package.json the "workspaces" key in viteplus must start with bare folder name while npm itself supports starting with relative path to current folder:

This works with npm but not with vite plus:

{
"workspaces": ["./apps/*"]
}

This is required for vite plus to work:

{
"workspaces": ["apps/*"]
}

I would expect this detection logic to work the same in vite plus and npm when I'm using npm workspaces otherwise it is quite confusing.

Reproduction

https://github.com/limzykenneth/vp-npm-monorepo-repro

Steps to reproduce

Start with the repro repo. Observe that the "workspaces" key in package.json uses paths starting with ./.

  1. Run vp i
  2. Verify that npm is able to recognize and install the monorepo packages as expected with vp list
  3. Run vp run -r build and it should be saying error: Task "build" not found
  4. Remove the leading ./ from the paths in "workspaces" then run vp run -r build again, it should work as expected now.

System Info

Environment:
Version 24.18.0
Source devEngines.runtime
Source Path /home/limzykenneth/sites/2050.cards/package.json
Project Root /home/limzykenneth/sites/2050.cards
Tool Paths:
node /home/limzykenneth/.vite-plus/js_runtime/node/24.18.0/bin/node
npm /home/limzykenneth/.vite-plus/js_runtime/node/24.18.0/bin/npm
npx /home/limzykenneth/.vite-plus/js_runtime/node/24.18.0/bin/npx
Package Manager:
Name npm
Version 12.0.1
Source devEngines.packageManager
Source Path /home/limzykenneth/sites/2050.cards/package.json
Project Root /home/limzykenneth/sites/2050.cards
Bin Path /home/limzykenneth/.vite-plus/package_manager/npm/12.0.1/npm/bin/npm
vp v0.2.5
Local vite-plus:
vite-plus v0.2.5
Tools:
vite v8.1.4
rolldown v1.1.5
vitest v4.1.10
oxfmt v0.58.0
oxlint v1.73.0
oxlint-tsgolint v0.24.0
tsdown v0.22.7
Environment:
Package manager npm v12.0.1
Node.js v24.18.0 (devEngines.runtime)

Used Package Manager

npm

Logs

Validations

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Fields

Priority

None yet

Effort

None yet

Target date

None yet

Start date

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions