Prerequisites
Reproduction url
https://github.com/astegmaier/playground-knip-6-tsconfig-bug
Reproduction access
Good version
5.88.1
Bad version
6.0.3
Description of the regression
When tsconfig.json has "outDir": "lib/" (with a trailing slash):
{
"compilerOptions": {
"outDir": "lib/",
"srcDir": "src/"
}
}
...and package.json has an export pointing to a lib/ path:
{
"exports": {
"./greet": "./lib/greet.js"
}
// ...
}
Knip 6 is unable to map lib/greet.js back to src/greet.ts, causing it to report src/greet.ts as an unused file, even though it's correctly exported and used.
Knip 5 handles this case fine.
It's possible to work around this by removing the trailing slash (typscript seems to requard lib/ and lib as equivalent. I thought it would be worth reporting anyways to keep things as seamless as possible for others.
Prerequisites
Reproduction url
https://github.com/astegmaier/playground-knip-6-tsconfig-bug
Reproduction access
Good version
5.88.1
Bad version
6.0.3
Description of the regression
When
tsconfig.jsonhas"outDir": "lib/"(with a trailing slash):{ "compilerOptions": { "outDir": "lib/", "srcDir": "src/" } }...and
package.jsonhas an export pointing to alib/path:{ "exports": { "./greet": "./lib/greet.js" } // ... }Knip 6 is unable to map
lib/greet.jsback tosrc/greet.ts, causing it to reportsrc/greet.tsas an unused file, even though it's correctly exported and used.Knip 5 handles this case fine.
It's possible to work around this by removing the trailing slash (typscript seems to requard
lib/andlibas equivalent. I thought it would be worth reporting anyways to keep things as seamless as possible for others.