fix: resolve import exports for unknown Rspack dependencies - #353
Merged
Merged
Conversation
nikita-jpg
requested review from
DakEnviy,
ValeraS and
dgaponov
as code owners
September 1, 2026 13:54
dgaponov
approved these changes
Sep 8, 2026
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.
What
importcondition to Rspack resolution for dependencies classified asunknown.requireandmoduleconditions.Why
A JavaScript package can contain ESM imports while omitting
type: module. Rspack may classify a nested dependency from such a package asunknown. When that dependency targets a public package subpath with separateimportandrequireexports, the ESM branch is not considered and resolution can fail.Scoping the additional condition to
byDependency.unknownfixes this case without changing resolution conditions globally.Reproduction example
@gravity-ui/chartkit@8.1.0is an affected real-world package. Its Yagr plugin imports the public@gravity-ui/yagr/reactsubpath, with@gravity-ui/yagr@5.2.0selected in the dependency graph.An application built with Rspack can fail while bundling this dependency graph:
With the
importcondition enabled forunknowndependencies, Rspack selects Yagr's public ESM export and the same dependency graph builds successfully.Testing
pnpm test --runInBandpnpm typecheckpnpm lintpnpm buildpnpm --filter "@examples/*" build