๐ Config with knip.js doesn't work correctly.
Closed this issue ยท 5 comments
Prerequisites
- I'm using the latest version
- I've read the relevant documentation
- I've searched for existing issues
- I've checked the list of known issues
- I've read the issue reproduction guide
Reproduction url
https://github.com/grubinstein/knip-js-error
Reproduction access
- I've made sure the reproduction is publicly accessible
Description of the issue
Problem occurs when using knip.js for configuration instead of knip.json. Please see minimal reproduction at https://github.com/grubinstein/knip-js-error .
When running "npm run knip", expected behaviour is that the file "unimported.js" should be reported as unused. In reality, the behaviour is unpredictable, either "nothing happens", ie the output is:
> knip-test@1.0.0 knip
> knip
or an error is thrown:
> knip-test@1.0.0 knip
> knip
[15264:0930/113216.239:ERROR:cache_util_win.cc(20)] Unable to move the cache: Access is denied. (0x5)
[15264:0930/113216.239:ERROR:disk_cache.cc(208)] Unable to create cache
Replacing knip.js with an equivalent knip.json resolves this issue, however knip.js is needed if dynamic config is desired.
Converting the project to commonJS doesn't seem to solve the problem.
Can't seem to reproduce. Changing knip.ts
and converting it to knip.json
gives the same result.
I don't know where that error comes from. You might be hitting some issue on your machine? Knip doesn't try to cache anything by default (there is a --cache
flag which you don't seem to be using and still I'd say those error messages seem unrelated). I can try to reproduce it on a Windows machine if you'd like.
Thanks for getting back to me. I should have said I'm running Windows, if you have access to a Windows box to try and reproduce I'd be very curious.
So this config works fine for you? On Linux?
Just to add to this. Typically the first time I run the command I don't get the error, there's just no output. On subsequent attempts I get the error. This is making me wonder if an error that occurs the first time I run the command is causing the process to terminate improperly, leaving some files locked. Then when I run the command again it errors out when trying to use those files somehow? I could be way off-base, just wanted to add that there is a pattern as to which result I get.
One more observation, I hadn't noticed this before because knip,.js was already open in my editor, but when I run "npm run knip" it opens the knip.js file for editing.
I can't reproduce this on a Windows machine either. Not seeing other similar reports, so I'm going to close this one, sorry.