Skip to content

fix(optimizer): avoid false-mapping warnings (fix #23512) - #23534

Closed
QIU-Guanzong wants to merge 1 commit into
vitejs:mainfrom
QIU-Guanzong:qiu/fix-browser-false-optimizer
Closed

QIU-Guanzong wants to merge 1 commit into
vitejs:mainfrom
QIU-Guanzong:qiu/fix-browser-false-optimizer

Conversation

@QIU-Guanzong

Copy link
Copy Markdown

Fixes #23512.

An explicit browser mapping to false resolves to Vite's bare browserExternalId. The dependency optimizer treated it like a regular browser-externalized builtin and installed the development Proxy, which emitted warnings despite the browser-field behavior being an empty module.

This routes the bare sentinel to an empty CJS module in both development and production. Sentinel IDs with a suffix continue through the existing Proxy path, so unsupported Node builtins retain their diagnostics.

Tests:

  • npx --yes pnpm@12.4.2 --filter=./packages/vite run build
  • npx --yes pnpm@12.4.2 run test-serve playground/optimize-deps/__tests__/optimize-deps.spec.ts
  • npx --yes pnpm@12.4.2 run test-build playground/optimize-deps/__tests__/optimize-deps.spec.ts
  • npx --yes pnpm@12.4.2 run test-serve playground/resolve/__tests__/resolve.spec.ts
  • targeted ESLint, Oxfmt, and git diff --check

AI assistance disclosure: AI assistance was used to investigate, prepare, and validate this focused change.

@github-actions github-actions Bot added the bot: likely Likely a bot, LLM, or agent. Automatically comments and closes the issue or PR label Sep 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been automatically flagged as likely to be created by a bot, LLM, or agent, and will be automatically closed. These contributions harm the maintenance of the project. Please read our AI policy for more information.

If you believe this is a mistake, please reply to this comment and we will review it.

@github-actions github-actions Bot closed this Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot: likely Likely a bot, LLM, or agent. Automatically comments and closes the issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid browser-external warnings for imports explicitly disabled by browser mappings

1 participant