Skip to content

Commit

Permalink
Always run config resolver (#884)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlj95 authored Dec 22, 2024
1 parent 17f2224 commit 94474cb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/knip/src/WorkspaceWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ export class WorkspaceWorker {
const plugin = Plugins[pluginName];
const hasResolveEntryPaths = typeof plugin.resolveEntryPaths === 'function';
const hasResolveConfig = typeof plugin.resolveConfig === 'function';
const shouldRunConfigResolver = hasResolveConfig && (!isProduction || (isProduction && 'production' in plugin));
const hasResolve = typeof plugin.resolve === 'function';
const config = this.getConfigForPlugin(pluginName);

Expand Down Expand Up @@ -319,7 +318,7 @@ export class WorkspaceWorker {
configFileDir: dirname(configFilePath),
configFileName: basename(configFilePath),
};
if (hasResolveEntryPaths || shouldRunConfigResolver) {
if (hasResolveEntryPaths || hasResolveConfig) {
const isManifest = basename(configFilePath) === 'package.json';
const fd = isManifest ? undefined : this.cache.getFileDescriptor(configFilePath);

Expand All @@ -336,7 +335,7 @@ export class WorkspaceWorker {
for (const entryPath of entryPaths) configEntryPaths.push(entryPath);
data.resolveEntryPaths = entryPaths;
}
if (shouldRunConfigResolver) {
if (hasResolveConfig) {
const inputs = (await plugin.resolveConfig?.(config, opts)) ?? [];
for (const input of inputs) {
if (isConfigPattern(input))
Expand Down

0 comments on commit 94474cb

Please sign in to comment.