Skip to content

Commit

Permalink
Fix up webpack plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Oct 31, 2024
1 parent fe8003d commit af71a39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/knip/src/plugins/webpack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ export const findWebpackDependenciesFromConfig = async ({ config, cwd }: { confi
const inputs = new Set<Input>();

for (const isProduction of passes) {
const env: Env = { production: isProduction };
const argv: Argv = { mode: isProduction ? 'production' : 'development' };
const mode = isProduction ? 'production' : 'development';
const env: Env = { production: isProduction, mode };
const argv: Argv = { mode };
const resolvedConfig = typeof config === 'function' ? await config(env, argv) : config;

for (const options of [resolvedConfig].flat()) {
Expand Down
2 changes: 1 addition & 1 deletion packages/knip/src/plugins/webpack/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Configuration } from 'webpack';

type Mode = 'none' | 'development' | 'production';
export type Env = { production: boolean };
export type Env = { production: boolean; mode: Mode };
export type Argv = { mode: Mode };

type Configurations = Configuration | Configuration[];
Expand Down

0 comments on commit af71a39

Please sign in to comment.