You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the repo there are some workspaces package having node.js's subpath exports (https://nodejs.org/api/packages.html#subpath-exports) to control its exports. Dependency cruiser's not-to-unresolvable resolves this in most case without a problem, but if there's a default exports and the others like
It looks like the issue is with the types export. When used with a * in the RHS, it needs one in the LHS as well (ref nodejs' packages#subpath-patterns documentation), as it's a replacement syntax instead of pattern matching
Updating packages/pkg-util/package.json to this will make that it works as expected (replaced all instances of "types" with "types/*").
I've removed the types from the "./notworks" export -> worked
I moved the types export above the import in the ./works export -> stopped working
removed the types value from the options.enhancedResolveOptions.conditionNames in .dependency-cruiser.js -> worked.
Only when re-reading the nodejs spec again I realised what the issue was.
B.t.w. dependency-cruiser uses enhanced-resolve for most of its module resolution logic. If after a discussion we think this behavior might need to change (i.e. because of interpretation differences) it'll ultimately have to be updated upstream.
Making a change to types -> types/* makes tsc fails to resolve those definitions. Similar to import, could have duplicated entry types and types/* as workaround but that is pretty similar to having duplicated import mappings.
Summary
Quick demo repo: https://github.com/kwonoj/wallaby-workspace-test/tree/test-depcruise-resolution
(
test-depcruise-resolution
) branchContext
In the repo there are some workspaces package having node.js's subpath exports (https://nodejs.org/api/packages.html#subpath-exports) to control its exports. Dependency cruiser's
not-to-unresolvable
resolves this in most case without a problem, but if there's adefault
exports and the others likeIt'll fail to falls back to
default
and fail to resolve given paths. Per https://nodejs.org/api/packages.html#conditional-exports, I expectdefault
should be the fallback to match.If I adjust exports condition and manually add
import
condition explicitly, then dependency cruiser seems to use those.This sort works, but requires to repeat same exports conditions twice for
import
anddefault
.The question is, is there a way to configure dependency cruiser to honor default exports condition match fallback?
Environment
The text was updated successfully, but these errors were encountered: