fix: pnpm rebuild should not add ignored built pkg to ignoredBuilds (#9344)

close #9338
This commit is contained in:
btea
2025-07-04 04:51:43 +08:00
committed by GitHub
parent 3aa0747310
commit ab155a5990
3 changed files with 10 additions and 2 deletions

View File

@@ -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).

View File

@@ -51,7 +51,7 @@ export type StrictRebuildOptions = {
peersSuffixMaxLength: number
strictStorePkgContentCheck: boolean
fetchFullMetadata?: boolean
} & Pick<Config, 'sslConfigs' | 'onlyBuiltDependencies' | 'onlyBuiltDependenciesFile' | 'neverBuiltDependencies'>
} & Pick<Config, 'sslConfigs' | 'onlyBuiltDependencies' | 'onlyBuiltDependenciesFile' | 'neverBuiltDependencies' | 'ignoredBuiltDependencies'>
export type RebuildOptions = Partial<StrictRebuildOptions> &
Pick<StrictRebuildOptions, 'storeDir' | 'storeController'> & Pick<Config, 'rootProjectManifest' | 'rootProjectManifestDir'>

View File

@@ -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<string>()