-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix(core): fixed package version matching when generating pnpm lockfile #30373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Bump |
const exactMatchedNode = nodes[`${nodeKeyPrefix}}@${packageJsonVersion}`] | ||
|| nodes[`${nodeKeyPrefix}}@${packageJsonVersion.replace(/^~/, '')}`] | ||
|| nodes[nodeKeyPrefix]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are syntax errors in the template literals - extra closing curly braces appear in both lines. Please correct:
// From:
nodes[`${nodeKeyPrefix}}@${packageJsonVersion}`]
nodes[`${nodeKeyPrefix}}@${packageJsonVersion.replace(/^~/, '')}`]
// To:
nodes[`${nodeKeyPrefix}@${packageJsonVersion}`]
nodes[`${nodeKeyPrefix}@${packageJsonVersion.replace(/^~/, '')}`]
These extra braces would cause incorrect key lookups in the nodes
object.
const exactMatchedNode = nodes[`${nodeKeyPrefix}}@${packageJsonVersion}`] | |
|| nodes[`${nodeKeyPrefix}}@${packageJsonVersion.replace(/^~/, '')}`] | |
|| nodes[nodeKeyPrefix]; | |
const exactMatchedNode = nodes[`${nodeKeyPrefix}@${packageJsonVersion}`] | |
|| nodes[`${nodeKeyPrefix}@${packageJsonVersion.replace(/^~/, '')}`] | |
|| nodes[nodeKeyPrefix]; |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
return nodes[nodeKey]; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function is missing a return value for the case when no compatible node is found. This could result in undefined
being returned, potentially causing errors elsewhere. Consider adding a default return value or explicit error handling at the end of the function.
} | |
return null; // No compatible node found | |
} |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
Current Behavior
When building an app using pnpm, webpack and NxAppWebpackPlugin with
generatePackageJson: true
, the error is thrown. This happens during pruned lockfile generation:Expected Behavior
No error should be thrown.
Related Issue(s)
Fixes #28627