There are some differences between pnpm v6 and pnpm v7 in how they execute commands, and the following should be noted:
pnpm v7:
When using pnpm to call the commands in package.json
, if you need to pass parameters to pnpm, you need to put the parameters before the command.
For example, using the pnpm --filter
parameter to run the prepare command:
If you need to pass parameters to the command, you need to put the parameters after the command.
For example, in the following package.json
configuration:
The way to pass parameters when running the command is:
pnpm v6:
In the following package.json
configuration:
If you need to run modern command --option
:
When using pnpm, you need to run pnpm run command -- --option
.
This is because pnpm's handling of command parameters is different from that of Yarn, but similar to that of npm: when the --
string is not added, the parameters passed are for pnpm; when the --
string is used, the parameters passed are for running the script.
In the above example, the --option
parameter is passed to modern command
. If you run pnpm run command --option
, the --option
parameter will be passed to pnpm.
In summary:
When using pnpm v7, if passing parameters to pnpm, the parameters need to be placed before the command.
When using pnpm v6, if the parameters are passed to pnpm, --
is not required; if the parameters are passed to the script, the --
string needs to be added.