Skip to content

Commit 315f1f0

Browse files
authored
fix: prevent pnpm from removing dev deps while in production (#19)
1 parent 2763b50 commit 315f1f0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/install.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,16 @@ export async function installPackage(names: string | string[], options: InstallP
3232
args.unshift('--prefer-offline')
3333
}
3434

35-
if (agent === 'pnpm' && existsSync(resolve(options.cwd ?? process.cwd(), 'pnpm-workspace.yaml')))
36-
args.unshift('-w')
35+
if (agent === 'pnpm' && existsSync(resolve(options.cwd ?? process.cwd(), 'pnpm-workspace.yaml'))) {
36+
args.unshift(
37+
'-w',
38+
/**
39+
* Prevent pnpm from removing installed devDeps while `NODE_ENV` is `production`
40+
* @see https://pnpm.io/cli/install#--prod--p
41+
*/
42+
'--prod=false',
43+
)
44+
}
3745

3846
return x(
3947
agent,

0 commit comments

Comments
 (0)