Skip to content

fix: use --config.prod escape hatch for pnpm compatibility - #24

Merged
antfu merged 1 commit into
mainfrom
fix/pnpm-12-prod-flag
Sep 15, 2026
Merged

antfu merged 1 commit into
mainfrom
fix/pnpm-12-prod-flag

Conversation

@antfubot

Copy link
Copy Markdown
Contributor

Summary

pnpm >=12.4.1 routes pnpm install <pkg> through its add-compatible argument parser (pnpm/pnpm#13888), which doesn't accept the --prod/--no-prod boolean flag we relied on to stop pnpm from removing devDependencies while NODE_ENV=production. This makes every installPackage() call using pnpm fail:

error: unexpected argument '--no-prod' found

See pnpm/pnpm#14868 for the upstream report.

Fix

Replace --prod=false with pnpm's --config.prod=false escape hatch, which bypasses per-command flag validation entirely and sets the same underlying config value. Verified against pnpm 11.15.1 and 12.4.1 that:

  • installing a named package via installPackage() succeeds on pnpm 12.4.1
  • existing devDependencies are still preserved under NODE_ENV=production

Fixes #23


This PR was created with the help of an agent.

pnpm >=12.4.1 routes `install <pkg>` through its `add`-compatible
argument parser, which rejects the `--prod`/`--no-prod` boolean flag
and makes installPackage() fail entirely. Switch to the `--config.`
escape hatch, which bypasses per-command flag validation and works
across pnpm 11 and 12.

Fixes #23
@antfu
antfu merged commit 6f66302 into main Sep 15, 2026
4 checks passed
@antfu
antfu deleted the fix/pnpm-12-prod-flag branch September 15, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

installPackage fails with pnpm 12.4.1

2 participants