Skip to content

Commit 45b7e4a

Browse files
Brooooooklynclaude
andcommitted
docs(test): update BUNDLING.md for new import path options
Document the enhanced vendor-aliases plugin capabilities: - vitest/browser-playwright now works when vitest is overridden - @voidzero-dev/vite-plus-test/* subpaths are supported - Clarify the two config file import options 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8dd480e commit 45b7e4a

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

packages/test/BUNDLING.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,12 @@ For maintainers developing the vitest/vite migration feature, here are the trans
108108
| `from "vite"` | `from "@voidzero-dev/vite-plus-core"` |
109109
| `from "vite/module-runner"` | `from "@voidzero-dev/vite-plus-core/module-runner"` |
110110

111-
**Note:** pnpm overrides don't affect Node.js module resolution at config load time, so config files must use the `@voidzero-dev/vite-plus-test/browser-playwright` import path.
111+
**Note:** When using pnpm overrides, you have two options for the playwright import:
112+
113+
- `vitest/browser-playwright` - works when `vitest` is overridden to our package
114+
- `@voidzero-dev/vite-plus-test/browser-playwright` - always works (direct import)
115+
116+
Importing from `@vitest/browser-playwright` requires an additional override for that specific package.
112117

113118
### package.json Changes
114119

@@ -151,8 +156,11 @@ overrides:
151156
// Before
152157
import { playwright } from '@vitest/browser-playwright';
153158

154-
// After
159+
// After - Option 1: Direct import (always works)
155160
import { playwright } from '@voidzero-dev/vite-plus-test/browser-playwright';
161+
162+
// After - Option 2: Via vitest subpath (works when vitest is overridden)
163+
import { playwright } from 'vitest/browser-playwright';
156164
```
157165

158166
### Plugin Exports for pnpm Overrides
@@ -315,7 +323,11 @@ This is achieved through:
315323
1. Conditional exports in package.json (`"node": "./dist/index-node.js"`)
316324
2. Browser-safe stubs for `module-runner`
317325
3. Import rewriting to prevent Node.js code from being pulled into browser bundles
318-
4. `vendor-aliases` plugin injection to resolve imports at runtime
326+
4. `vendor-aliases` plugin injection to resolve imports at runtime:
327+
- Handles `@vitest/*` imports → resolves to copied `dist/@vitest/` files
328+
- Handles `vitest/*` subpaths → resolves to dist files (enables `vitest/browser-playwright` usage)
329+
- Handles `@voidzero-dev/vite-plus-test/*` subpaths → maps to equivalent vitest paths
330+
- Intercepts `vitest/browser` → returns virtual module ID for BrowserContext plugin
319331

320332
### Key Constants
321333

0 commit comments

Comments
 (0)