Description
Path alias resolution via tsconfig.json paths stopped working when upgrading from 1.11.0 to 1.12.2. The resolver returns no path for aliased specifiers (e.g. $/utils/helper) when references: 'auto' is set and the main tsconfig.json has a references array pointing to another tsconfig.
Relative imports (./utils/helper) still resolve correctly in both versions.
Reproduction
Minimal reproduction repo: https://github.com/arkadiusz-swierczek-pm/unrs-resolver-error
Setup
tsconfig.json — defines a $/* path alias and references tsconfig.node.json:
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Bundler",
"paths": { "$/*": ["./src/*"] }
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
Resolver options:
const resolverOpts = {
tsconfig: {
configFile: 'tsconfig.json',
references: 'auto',
},
extensions: ['.ts', '.tsx', '.js', '.jsx'],
};
Expected behavior
"$/utils/helper" → /path/to/test/src/utils/helper.ts
Actual behavior
| Specifier |
v1.11.0 |
v1.12.2 |
$/utils/helper |
Resolves correctly |
no path |
./utils/helper |
Resolves correctly |
Resolves correctly |
Versions
- Working:
unrs-resolver@1.11.0
- Broken:
unrs-resolver@1.12.2
- Platform: Windows 11, Node.js
Description
Path alias resolution via
tsconfig.jsonpathsstopped working when upgrading from1.11.0to1.12.2. The resolver returns no path for aliased specifiers (e.g.$/utils/helper) whenreferences: 'auto'is set and the maintsconfig.jsonhas areferencesarray pointing to another tsconfig.Relative imports (
./utils/helper) still resolve correctly in both versions.Reproduction
Minimal reproduction repo: https://github.com/arkadiusz-swierczek-pm/unrs-resolver-error
Setup
tsconfig.json— defines a$/*path alias and referencestsconfig.node.json:{ "compilerOptions": { "module": "ESNext", "moduleResolution": "Bundler", "paths": { "$/*": ["./src/*"] } }, "include": ["src"], "references": [{ "path": "./tsconfig.node.json" }] }Resolver options:
Expected behavior
Actual behavior
$/utils/helper./utils/helperVersions
unrs-resolver@1.11.0unrs-resolver@1.12.2