Skip to content

Commit af71a39

Browse files
committedOct 31, 2024
Fix up webpack plugin
1 parent fe8003d commit af71a39

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
 

‎packages/knip/src/plugins/webpack/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ export const findWebpackDependenciesFromConfig = async ({ config, cwd }: { confi
7272
const inputs = new Set<Input>();
7373

7474
for (const isProduction of passes) {
75-
const env: Env = { production: isProduction };
76-
const argv: Argv = { mode: isProduction ? 'production' : 'development' };
75+
const mode = isProduction ? 'production' : 'development';
76+
const env: Env = { production: isProduction, mode };
77+
const argv: Argv = { mode };
7778
const resolvedConfig = typeof config === 'function' ? await config(env, argv) : config;
7879

7980
for (const options of [resolvedConfig].flat()) {

‎packages/knip/src/plugins/webpack/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Configuration } from 'webpack';
22

33
type Mode = 'none' | 'development' | 'production';
4-
export type Env = { production: boolean };
4+
export type Env = { production: boolean; mode: Mode };
55
export type Argv = { mode: Mode };
66

77
type Configurations = Configuration | Configuration[];

0 commit comments

Comments
 (0)