diff --git a/common/changes/@microsoft/rush-lib/fix-npmrc-syncing_2026-02-19-02-14.json b/common/changes/@microsoft/rush-lib/fix-npmrc-syncing_2026-02-19-02-14.json new file mode 100644 index 00000000000..bb37b050f97 --- /dev/null +++ b/common/changes/@microsoft/rush-lib/fix-npmrc-syncing_2026-02-19-02-14.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Fix .npmrc syncing to common/temp incorrectly caching results, which caused pnpm-specific properties like hoist-pattern to be stripped when the same .npmrc was processed with different options.", + "type": "none" + } + ], + "packageName": "@microsoft/rush" +} diff --git a/libraries/rush-lib/src/utilities/npmrcUtilities.ts b/libraries/rush-lib/src/utilities/npmrcUtilities.ts index 6e5b1da615f..7ca6febe487 100644 --- a/libraries/rush-lib/src/utilities/npmrcUtilities.ts +++ b/libraries/rush-lib/src/utilities/npmrcUtilities.ts @@ -19,9 +19,6 @@ export interface ILogger { * The text of the the .npmrc. */ -// create a global _combinedNpmrc for cache purpose -const _combinedNpmrcMap: Map = new Map(); - function _trimNpmrcFile( options: Pick< INpmrcTrimOptions, @@ -41,10 +38,6 @@ function _trimNpmrcFile( filterNpmIncompatibleProperties, env = process.env } = options; - const combinedNpmrcFromCache: string | undefined = _combinedNpmrcMap.get(sourceNpmrcPath); - if (combinedNpmrcFromCache !== undefined) { - return combinedNpmrcFromCache; - } let npmrcFileLines: string[] = []; if (linesToPrepend) { @@ -70,9 +63,6 @@ function _trimNpmrcFile( const combinedNpmrc: string = resultLines.join('\n'); - //save the cache - _combinedNpmrcMap.set(sourceNpmrcPath, combinedNpmrc); - return combinedNpmrc; }