Skip to content

Conversation

@hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Nov 28, 2025

Description

Resolves #8995

When optimizer is enabled for Vite SSR, Vite resolves non-optimized node_modules path with ?v=xxx. This confuses Vitest's shouldExternalize logic since you cannot readFile(id) with query parameters, which then causes all node_modules to be inlined.

Not exactly sure where and how much we should strip off queries. For this PR, it strips during isValidNodeImport check only and keep queries for actual Node native import if it externalized as Node support that.

Test

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@netlify
Copy link

netlify bot commented Nov 28, 2025

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 43d0e22
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6929735daf85060008efbad6
😎 Deploy Preview https://deploy-preview-9125--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 28, 2025

@vitest/browser

npm i https://pkg.pr.new/@vitest/browser@9125

@vitest/browser-playwright

npm i https://pkg.pr.new/@vitest/browser-playwright@9125

@vitest/browser-preview

npm i https://pkg.pr.new/@vitest/browser-preview@9125

@vitest/browser-webdriverio

npm i https://pkg.pr.new/@vitest/browser-webdriverio@9125

@vitest/coverage-istanbul

npm i https://pkg.pr.new/@vitest/coverage-istanbul@9125

@vitest/coverage-v8

npm i https://pkg.pr.new/@vitest/coverage-v8@9125

@vitest/expect

npm i https://pkg.pr.new/@vitest/expect@9125

@vitest/mocker

npm i https://pkg.pr.new/@vitest/mocker@9125

@vitest/pretty-format

npm i https://pkg.pr.new/@vitest/pretty-format@9125

@vitest/runner

npm i https://pkg.pr.new/@vitest/runner@9125

@vitest/snapshot

npm i https://pkg.pr.new/@vitest/snapshot@9125

@vitest/spy

npm i https://pkg.pr.new/@vitest/spy@9125

@vitest/ui

npm i https://pkg.pr.new/@vitest/ui@9125

@vitest/utils

npm i https://pkg.pr.new/@vitest/utils@9125

vitest

npm i https://pkg.pr.new/vitest@9125

@vitest/web-worker

npm i https://pkg.pr.new/@vitest/web-worker@9125

@vitest/ws-client

npm i https://pkg.pr.new/@vitest/ws-client@9125

commit: 43d0e22

@hi-ogawa hi-ogawa marked this pull request as ready for review November 28, 2025 10:03
@sheremet-va sheremet-va merged commit 4c75492 into vitest-dev:main Nov 28, 2025
16 of 17 checks passed
@hi-ogawa hi-ogawa deleted the 11-28-fix_fix_external_behavior_with_deps.optimizer_ branch November 29, 2025 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v4: all packages are inlined with deps.optimizer ("Sourcemap for ... points to missing files", when using deps.optimizer.{mode}.enabled and include)

2 participants