-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Automatically pick up knip.mjs and knip.cjs #478
Comments
Sorry, I'd rather make that list smaller than bigger. Hopefully the ecosystem can agree on some conventions and we'll move on from CJS to ESM too. I could even imagine supporting only JSON, since compilers might become a solved problem. Let's see where this goes. I'm not against the idea per se, but not at this time. |
What convention? Those two extensions are here to stay and will never not be used. There are a lot of people who are unable/unwilling to switch to ESM, or are in these partial states because of other tools that don't support ESM.
A solved problem in knip or in development? Because webpack is not going anywhere anytime soon either. |
A solved problem in Knip, as compilers are basically the only reason Knip has dynamic config files in the first place. Going back to JSON(C) only and we wouldn't even have this conversation :) |
How will knip read the entry points from webpack's config without importing webpack's config? Would I have to repeat them and hope they will not get out of sync? |
OK I think I see we're the confusion stems from. Let's break it down:
Sorry, I didn't dive into the links you've sent and explain immediately. You shouldn't need to do any of this: https://github.com/pixiebrix/pixiebrix-extension/blob/951da774d2ecb296f381b3b6cda128be790fac3f/knip.mjs#L1-L14 Knowing this, if anything isn't working as expected, please file an issue :) |
I tried it but it wasn't picked up automatically. Could it be because of the mjs extension of the webpack config? |
|
The file is executed, I see the console.logs within it, but its entries don't appear in Knip's debug output. Does knip support config factories? https://webpack.js.org/configuration/configuration-types/#exporting-a-function With the current setup, I get 0 unused exports, but if I remove the explicit webpack import I get 64 unused exports and 87 unused files |
Yes, it does, there's quite a few scenarios Knip supports (including tests/coverage/fixtures), but there can always be something missing or bugs. Please file a separate issue with a repro so I can look into it 🙏 |
https://knip.dev/overview/configuration#location
Could you add these two extensions to the list of files knip automatically looks for? So I don't have to add
--config knip.mjs
Reasoning
My app doesn't use type=module, but my webpack config does (.mjs), which means that knip also has to be loaded as a module.
https://github.com/pixiebrix/pixiebrix-extension/blob/951da774d2ecb296f381b3b6cda128be790fac3f/knip.mjs#L1
The text was updated successfully, but these errors were encountered: