voidzero-dev / voidzero-dev/vite-plus

vp test fails with Yarn PnP: Cannot find package 'vite-plus'

Đang mở
#640 4 bình luận 0 reaction 1 người được giao Được @fengmk2 nhận Xem trên GitHub
Ngôn ngữ chính
Rust
Star
5.8k
Fork
262
Merge trung bình
23 giờ 41 phút
Pull request đã merge (30 ngày)
138

Mô tả

## Description

`vp test` fails on projects using Yarn PnP (Plug'n'Play) mode. The bundled config file cannot resolve the `vite-plus` module because Yarn PnP does not use a traditional `node_modules` layout.

## Error

```
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'vite-plus' imported from vitest.config.mts.timestamp-xxx.mjs
```

The full error from `vp test run`:

```
vitest.config.mts (1:468) Warning: Could not resolve 'vite-plus' in vitest.config.mts

failed to load config from vitest.config.mts

⎯⎯⎯⎯⎯ Startup Error ⎯⎯⎯⎯⎯
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'vite-plus' imported from vitest.config.mts.timestamp-xxx.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:301:9)
at packageResolve (node:internal/modules/esm/resolve:768:81)
...
```

## Reproduction

- Repository: https://github.com/fengmk2/vitest-extension-1.42.0-fail-yarn
- Branch: `vp-migrate-yarn-pnp`
- PR with CI failure: https://github.com/fengmk2/vitest-extension-1.42.0-fail-yarn/pull/1

Steps:
1. Clone the repo and checkout `vp-migrate-yarn-pnp`
2. Run `vp install`
3. Run `vp test run`

## Environment

- Vite+ version: `v0.0.0-g52709db6.20260226-1136`
- Yarn version: `4.12.0`
- Node.js: `24.14.0`
- OS: Ubuntu (GitHub Actions) / macOS

## Config

`vitest.config.mts`:
```ts
import { defineConfig } from 'vite-plus';
```

`package.json` (relevant parts):
```json
{
"packageManager": "yarn@4.12.0",
"devDependencies": {
"vite-plus": "catalog:"
},
"resolutions": {
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
"vitest": "npm:@voidzero-dev/vite-plus-test@latest"
}
}
```

The project uses Yarn PnP (`.pnp.cjs` present, `nodeLinker` not set to `node-modules`).

## Expected Behavior

`vp test` should work with Yarn PnP projects, resolving `vite-plus` through Yarn's PnP resolution.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.