//vp-942-array-testbykazupon

vp-942-array-test

verify for https://github.com/voidzero-dev/vite-plus/pull/1072#pullrequestreview-3985780257

0
0
0
CSS

vp-942-array-test

Verification project for PR #1072 review comment: whether root pack array entries cause unintended builds from subpackages.

Created with vp create vite:monorepo, then modified to add a packages/no-config package (no vite.config.ts) and root pack array config.

Structure

vp-942-array-test/
├── vite.config.ts          # pack: [{ format: ['esm'] }, { format: ['cjs'] }]
├── tsconfig.json
├── pnpm-workspace.yaml
├── verify.mjs              # Standalone verification script
├── packages/
│   ├── utils/              # Has its own vite.config.ts (uses local config)
│   │   ├── vite.config.ts
│   │   └── src/index.ts
│   └── no-config/          # No vite.config.ts (uses root config via traverseUp)
│       └── src/index.ts
└── apps/
    └── website/

Setup

vp install

Verification

Run the standalone verification script from each package:

# From no-config (no local vite.config.ts → traverseUp finds root config)
cd packages/no-config
node ../../verify.mjs

# From utils (has local vite.config.ts → uses local config, no traverseUp)
cd ../utils
node ../../verify.mjs

What to verify

  1. no-config: Root pack array (ESM + CJS) is found via traverseUp, but root stays as cwd so entry: src/index.ts resolves from packages/no-config/src/index.ts
  2. utils: Local vite.config.ts is used, traverseUp does not trigger
  3. No cross-package builds — each subpackage only resolves its own src/index.ts

Results

From packages/no-config

hasViteConfig(cwd): false
traverseUp found: <root>/vite.config.ts
pack: array with 2 entries
  [0] entry: src/index.ts → <root>/packages/no-config/src/index.ts (exists: true)
  [1] entry: src/index.ts → <root>/packages/no-config/src/index.ts (exists: true)

From packages/utils

hasViteConfig(cwd): true
Using local vite.config (no traverseUp needed)
pack: single entry → <root>/packages/utils/src/index.ts (exists: true)

Conclusion

The Codex concern about sibling packages being built is not an issue because root stays as cwd. All path resolution happens relative to the subpackage directory, not the root. When invoked via vp run, vite-task’s caching also prevents unnecessary rebuilds.

[beta]v0.14.0