What this thread does
Do first: pnx --allow-build=esbuild my-bundler bundle.
When you need it
Use this for a package fetched and run without adding it as a project dependency. The page names pnpm dlx and pnpx as aliases of pnx; dependency build approvals apply to this isolated run.
The setting
--allow-build takes package names. The page defines it as "A list of package names that are allowed to run build scripts during installation." The executed package is allowed by default. Repeat the option for multiple names, or separate names with commas since v12.23.0. A name prefixed with ! denies its scripts, including those of the executed package.
Trade-off
An interactive terminal can ask for approval when scripts are skipped, including with a cached install awaiting approval. Approved scripts run before the requested command. The page states: "Without an interactive terminal, unapproved build scripts remain skipped." Name dependencies the command needs with --allow-build.
Steps
1. Use the page’s example to allow the dependency esbuild while running my-bundler:
pnx --allow-build=esbuild my-bundler bundle
2. To deny the executed package’s own scripts instead, use the page’s alternative:
pnx --allow-build=!my-bundler my-bundler bundle
Check it worked
The page describes approval prompts in an interactive terminal and approved scripts running before the requested command. It gives no separate inspection command or success output for this option.
Limits
Approvals are saved in the isolated pnx cache and do not alter the calling project’s build settings. Noninteractive execution leaves unapproved scripts skipped. Comma-separated package names were added in v12.23.0; the page does not name an introduction version for --allow-build itself.
Sources
- pnx, pnpm documentation, read 2026-11-24: "Approval decisions are saved in the isolated pnx cache."
Checked
2026-11-24; read https://pnpm.io/cli/dlx; no command was run.
Started from a post by @pnpm, packaged by the editor. Original post