Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After upgrading Knip to latest version 5.41.1 from 5.38.2 in an Angular project found out that a file that was previously correctly tracked as production entry was suddenly appearing as unused file (specifically,
src/main.ts
) when using knip in production mode. I've been working with the Angular plugin recently, so first thought was I may have messed up something. That file is added as production entry because appears inbrowser
option of thebuild
target inangular.json
.However, that piece of code hasn't changed and the file should be added as production entry. After manually bisecting which version introduced the bug, seems it appears in 5.39.2. In there, there's a plugin housekeeping commit that removes the empty
production
array from the plugin. However, due to a check when running plugins, theresolveConfig
function won't be executed when running in production mode if noproduction
key is present in the plugin. Hence when removing that emptyproduction
array from the Angular plugin, theresolveConfig
function wasn't ran and the production entrysrc/main.ts
wasn't added.Given the issue, I could have brought back the
production
empty array to the Angular plugin. However, I think that it's better to always run theresolveConfig
function if is defined. Both in production and non-production modes. Because several plugins actually use thetoProductionEntry
function as part ofresolveConfig
. So this issue could happen in the case thatproduction
key is removed and all production entries are added as part ofresolveConfig
. Let me know if there's something else I may be missing though!