Skip to content

fix(test): preserve vitest/browser bare specifier in browser-context files#811

Merged
fengmk2 merged 1 commit intomainfrom
fix-vitest-change
Mar 13, 2026
Merged

fix(test): preserve vitest/browser bare specifier in browser-context files#811
fengmk2 merged 1 commit intomainfrom
fix-vitest-change

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Mar 13, 2026

The build process was rewriting "vitest/browser" to a relative
"./index.js" path inside @vitest/browser/ chunk files. This caused
browser-side code to import the Node.js server file (~9000 lines) instead
of resolving through Vite's virtual module plugin, which broke
page.extend() for playwright locators (getByText, getByRole, etc.).

Replace the fragile regex-based workaround with specifierMap.delete()
to preserve the bare specifier for Vite's plugin resolution.

…files

The build process was rewriting `"vitest/browser"` to a relative
`"./index.js"` path inside `@vitest/browser/` chunk files. This caused
browser-side code to import the Node.js server file (~9000 lines) instead
of resolving through Vite's virtual module plugin, which broke
`page.extend()` for playwright locators (getByText, getByRole, etc.).

Replace the fragile regex-based workaround with `specifierMap.delete()`
to preserve the bare specifier for Vite's plugin resolution.
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 13, 2026

Deploy Preview for viteplus-staging canceled.

Name Link
🔨 Latest commit 0b2a781
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-staging/deploys/69b3903d7fdb650008adf8ff

Copy link
Copy Markdown
Member Author

fengmk2 commented Mar 13, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fengmk2 fengmk2 requested a review from Brooooooklyn March 13, 2026 04:19
@fengmk2 fengmk2 self-assigned this Mar 13, 2026
@fengmk2 fengmk2 marked this pull request as ready for review March 13, 2026 04:19
Copy link
Copy Markdown
Member Author

fengmk2 commented Mar 13, 2026

Merge activity

  • Mar 13, 4:31 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 13, 4:31 AM UTC: @fengmk2 merged this pull request with Graphite.

@fengmk2 fengmk2 merged commit 29c406b into main Mar 13, 2026
38 checks passed
@fengmk2 fengmk2 deleted the fix-vitest-change branch March 13, 2026 04:31
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

Successfully merging this pull request may close these issues.

2 participants