Conversation
The check compares Node's resolution against the package manifest and never sees Vite's module graph, so a package only Node requires looks exactly like one both graphs load. It fired on every test file for test-renderer (required by React Native Testing Library), nanoid (required by postcss) and Babel's source-map packages, none of which Vite loads. It now runs under diagnostics, where the silent duplicate-instance failure it was written to surface is still worth reporting. The message says it is a risk rather than a proven duplicate, and that its comparison uses Vite's default main fields. Fixes #201
Node's ESM loader rejects a bare Windows path ('D:\…') as an unsupported
URL scheme, so the subprocess that drives the require hook failed on the
Windows leg of the gate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #201. Thanks to @doutatsu for the report, and for tracing it to
checkResolverAgreement— the analysis was right.Problem
Every test file printed
'test-renderer' resolves to two different files, along with the same warning fornanoidand Babel's source-map packages. Nothing in those projects loads those packages through Vite: Node requirestest-rendererfrom React Native Testing Library andnanoidfrom postcss.The check runs on every Node
requireand compares the resolved file against the first Vite main field in the package manifest. It has no view of Vite's module graph, so a package only Node ever requires is indistinguishable from one both graphs load. Its suggested remedy didn't help either, because it compares against a fixed field list rather than the project'sresolve.mainFields.Change
diagnosticsonly. The silent duplicate-instance failure it was written to surface — a store written through one copy reading back unset through the other — is still worth reporting to someone debugging it.Verification
tests/resolver-agreement-gate.test.tsdrives the installedrequirehook in a subprocess, rather than calling the checker directly, because the gate is at the call site. It asserts silence by default and the warning under diagnostics, and fails without the change.node-linker=hoisted, RNTL 14), the warnings are gone by default and still appear withdiagnostics: true.prepublishOnlypasses, plusformat:check.