-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: configure node.js subpath exports resolution for 'not-to-unresolvable' #976
Comments
Hi @kwonoj thanks for reaching out. It looks like the issue is with the Updating {
"name": "@test/util",
"imports": {
"#util/*": [
"./src/*",
"./src/*.ts"
]
},
"exports": {
"./util": "./src/util.ts",
"./works": {
"import": [
"./src/util.ts"
],
"types/*": "./src/*.d.ts",
"default": [
"./src/util.ts"
]
},
"./notworks": {
"types/*": "./src/*.d.ts",
"default": [
"./src/util.ts"
]
}
},
"devDependencies": {
"@test/tsconfig": "workspace:^"
}
} backgroundIt took me a bit to find this
Only when re-reading the nodejs spec again I realised what the issue was. B.t.w. dependency-cruiser uses |
But Making a change to |
Oh wow, so for types, someone decided to use a different type of resolutions than everything else in subpath exports? That's a surprising choice ... So, if indeed this behavior needs to change, it will need to be adapted in enhanced-resolve. |
I may not be correct but so far I know types field was created as userlevel field prior to subpath so subpath couldn't break its compatibility. |
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: