GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `vite-plus/test/browser-playwright` is error-typed under NodeNext · Issue #2354 · voidzero-dev/vite-plus

vite-plus/test/browser-playwright is error-typed under NodeNext #2354

New issue
Copy link
New issue
Copy link
Closed
Bug
#2360
Closed
vite-plus/test/browser-playwright is error-typed under NodeNext#2354
Bug
#2360
Copy link
Assignees
jong-kyung
Labels
bugSomething isn't working
Milestone
RC

Description

@eai04191
eai04191
opened on Aug 6, 2026
Issue body actions

Describe the bug

Importing playwright from vite-plus/test/browser-playwright causes Oxlint type-aware rules to treat playwright() as an error-typed value when the consumer uses NodeNext module resolution.

vp check reports typescript(no-unsafe-return) and typescript(no-unsafe-assignment). Changing only the import to @vitest/browser-playwright makes the same configuration pass. Browser tests pass with either import, so the runtime implementation is unaffected.

The published dist/test/browser-playwright.d.ts rewrites Vitest bare module specifiers to extensionless relative ESM specifiers such as ./node, ./browser, and ./_at-vitest-browser. TypeScript reports TS2834 or TS2835 for these declarations under NodeNext when library checking is enabled, while Oxlint resolves the provider as an error-typed value.

vite-plus/packages/cli/build.ts

Lines 842 to 851 in 7586d91

const relToShim = (sub: string): string => {
const r = relative(outDir, testDistDir).replaceAll('\\', '/');
const prefix = r === '' ? '.' : r.startsWith('.') ? r : `./${r}`;
return `${prefix}/${sub}`;
};
let result = upstream;
for (const [bare, sub] of VITEST_TYPE_SPECIFIER_REWRITES) {
const escaped = bare.replaceAll('/', '\\/');
const pattern = new RegExp(`(['"])${escaped}\\1`, 'g');
result = result.replaceAll(pattern, `'${relToShim(sub)}'`);

I confirmed the cause by adding .js only to those generated relative specifiers. Both Oxlint diagnostics disappeared, and TypeScript declaration output resolved the return type as import("vitest/node").BrowserProviderOption instead of emitting an unqualified BrowserProviderOption.

This reproduces with Vite+ 0.2.7 and 0.2.8. The generated browser-playwright.d.ts files in both releases are byte-for-byte identical.

This differs from #1634: that issue concerned duplicate Vitest type identities when importing @vitest/browser-playwright directly. Here, the Vite+ re-export itself becomes error-typed under NodeNext.

The impact is that the vite-plus/prefer-vite-plus-imports rule recommends an import that makes vp check fail in a valid NodeNext configuration. The current workaround is to keep the direct import and suppress that rule.

A possible fix is to emit NodeNext-compatible .js specifiers from relToShim and add a regression test covering the generated provider declarations with NodeNext and type-aware Oxlint.

Reproduction

https://github.com/eai04191/vite-plus-browser-playwright-nodenext-reproduction

Steps to reproduce

  1. Clone the reproduction repository.
  2. Run pnpm install --frozen-lockfile.
  3. Run pnpm run check and observe the two error-typed-value diagnostics.
  4. Run pnpm run check:direct; the equivalent configuration using @vitest/browser-playwright passes.
  5. Run pnpm run typecheck and pnpm run typecheck:direct; both pass with skipLibCheck.
  6. Run pnpm run install-browser, pnpm test, and pnpm run test:direct; both browser tests pass.

System Info

$ vp env current
error: Command 'env' not found

$ vp --version
vp v0.2.8

Local vite-plus:
  vite-plus  v0.2.8

Tools:
  vite             v8.2.0
  rolldown         v1.2.2
  vitest           v4.1.10
  oxfmt            v0.61.0
  oxlint           v1.76.0
  oxlint-tsgolint  v7.0.2001
  tsdown           v0.22.14

Node.js v26.5.0
pnpm 11.1.2
macOS 15.7.7 arm64

Used Package Manager

pnpm

Logs

$ pnpm run check
$ vp check --no-fmt vite.config.ts

typescript(no-unsafe-return): Unsafe return of a value of type error.
  vite.config.ts:5:3
  return playwright({});

typescript(no-unsafe-assignment): Unsafe assignment of an error typed value.
  vite.config.ts:25:7
  provider: createPlaywrightProvider(),

Found 2 errors and 0 warnings in 1 file

Validations

  • Read the Contributing Guidelines.
  • Checked open and closed issues and pull requests for the same bug.
  • Confirmed this is caused by Vite+'s generated declarations rather than Vitest or Oxlint.
  • The public reproduction is minimal and independently runnable.

byCodex

Activity

  1. eai04191 commented on Aug 6, 2026

    @eai04191
    eai04191
    on Aug 6, 2026
    ContributorAuthor
    More actions

    My dumb agent ignored the rules and posted the issue via the CLI, so the template metadata wasn't applied. I apologize.

    Reacted by JongKyung Lee
  2. jong-kyung
    added
    bugSomething isn't working
    on Aug 6, 2026
  3. jong-kyung
    added the
    Bug
    issue type on Aug 6, 2026
  4. jong-kyung commented on Aug 6, 2026

    @jong-kyung
    jong-kyung
    on Aug 6, 2026
    Collaborator
    More actions

    I'll take a look.

  5. jong-kyung
    self-assigned this
    on Aug 6, 2026
  6. jong-kyung commented on Aug 6, 2026

    @jong-kyung
    jong-kyung
    on Aug 6, 2026
    Collaborator
    More actions

    @eai04191 Thanks for the detailed report. You're right, this is a bug, and your analysis is correct. Would you be willing to
    open a PR?

    Reacted by y.takahashi
  7. fengmk2
    added this to the RC milestone on Aug 6, 2026
  8. fengmk2
    added a commit that references this issue on Aug 6, 2026

    fix(test): emit NodeNext-compatible provider type specifiers (#2360)

    This issue will close once commit 0382b54 is merged into the 'main' branch.
    0382b54
  9. fengmk2
    closed this as completedin #2360on Aug 6, 2026
  10. fengmk2 commented on Aug 6, 2026

    @fengmk2
    fengmk2
    on Aug 6, 2026
    Member
    More actions

    Verified with the preview build from #2359 (0.0.0-commit.d5ce0346f8f210ede05fa97dc522e192270b3813), which contains the fix from #2360.

    I migrated the reproduction repo onto that build and compared it against 0.2.8:

    Check 0.2.8 preview build
    pnpm run check (vite-plus/test/browser-playwright) 2 errors pass
    pnpm run check:direct (@vitest/browser-playwright) pass pass
    pnpm run typecheck / typecheck:direct pass pass
    pnpm test / test:direct (browser) pass pass

    The generated declaration now emits NodeNext specifiers:

    // node_modules/vite-plus/dist/test/browser-playwright.d.ts
    import { CustomComparatorsRegistry } from './_at-vitest-browser.js';
    import { ScreenshotMatcherOptions, ... } from './browser.js';
    import { BrowserProvider, ..., BrowserProviderOption } from './node.js';

    The provider type resolves as expected:

    export declare function createPlaywrightProvider(): import("vitest/node").BrowserProviderOption<import("vite-plus/test/browser-playwright").PlaywrightProviderOptions>;

    A --skipLibCheck false run reports no TS2834 or TS2835 for browser-playwright.d.ts. The remaining diagnostics are unrelated: missing optional peer types in tsdown/index-types.d.ts (publint, @arethetypeswrong/core, @volar/typescript), and TS1540 namespace warnings from [email protected] under TypeScript 7.

    One more result: vp migrate rewrote the control case direct/vite.config.ts to vite-plus/test/browser-playwright through the prefer-vite-plus-imports rule, and vp check still passes. The rule no longer recommends an import that breaks a NodeNext project.

    Reacted by JongKyung Lee and y.takahashi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @jong-kyung
    jong-kyung

Labels

bugSomething isn't working

Type

Bug

Fields

Priority

None yet

Effort

None yet

Target date

None yet

Start date

None yet

Projects

No projects

    Milestone

    • RC

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.