From ab155a59901005ca74435201c249dd07c3b38316 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Fri, 4 Jul 2025 04:51:43 +0800 Subject: [PATCH] fix: pnpm rebuild should not add ignored built pkg to ignoredBuilds (#9344) close #9338 --- .changeset/nice-squids-sniff.md | 6 ++++++ .../src/implementation/extendRebuildOptions.ts | 2 +- exec/plugin-commands-rebuild/src/implementation/index.ts | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .changeset/nice-squids-sniff.md diff --git a/.changeset/nice-squids-sniff.md b/.changeset/nice-squids-sniff.md new file mode 100644 index 0000000000..dd0dcf4d9e --- /dev/null +++ b/.changeset/nice-squids-sniff.md @@ -0,0 +1,6 @@ +--- +"@pnpm/plugin-commands-rebuild": patch +pnpm: patch +--- + +The `pnpm rebuild` command should not add pkgs included in `ignoredBuiltDependencies` to `ignoredBuilds` in `node_modules/.modules.yaml` [#9338](https://github.com/pnpm/pnpm/issues/9338). diff --git a/exec/plugin-commands-rebuild/src/implementation/extendRebuildOptions.ts b/exec/plugin-commands-rebuild/src/implementation/extendRebuildOptions.ts index ad0eeefa60..9f58df84f5 100644 --- a/exec/plugin-commands-rebuild/src/implementation/extendRebuildOptions.ts +++ b/exec/plugin-commands-rebuild/src/implementation/extendRebuildOptions.ts @@ -51,7 +51,7 @@ export type StrictRebuildOptions = { peersSuffixMaxLength: number strictStorePkgContentCheck: boolean fetchFullMetadata?: boolean -} & Pick +} & Pick export type RebuildOptions = Partial & Pick & Pick diff --git a/exec/plugin-commands-rebuild/src/implementation/index.ts b/exec/plugin-commands-rebuild/src/implementation/index.ts index bf9f70afbf..5c96c73307 100644 --- a/exec/plugin-commands-rebuild/src/implementation/index.ts +++ b/exec/plugin-commands-rebuild/src/implementation/index.ts @@ -310,7 +310,9 @@ async function _rebuild ( const _allowBuild = createAllowBuildFunction(opts) ?? (() => true) const allowBuild = (pkgName: string) => { if (_allowBuild(pkgName)) return true - ignoredPkgs.push(pkgName) + if (!opts.ignoredBuiltDependencies?.includes(pkgName)) { + ignoredPkgs.push(pkgName) + } return false } const builtDepPaths = new Set()